手把手學習nginx(一)

來源:互聯網
上載者:User
一、           為什麼是nginx

高並發:支援Linux上的epoll,Solaris上的event ports和FreeBSD上的kqueue等。單機支援10w以上的並發串連。

模組化:高擴充性,由多個不同功能,不同層次,不同類型,耦合度低的模組組成。

低記憶體消耗:10000個非活躍的HTTP Keep-Alive串連僅水碓2.5MB的記憶體。

熱部署:master和worker背景工作處理序分離設計,支援熱部署,7*24小時不間斷服務。 二、           搭建nginx環境 2.1 支援作業系統

Linux(推薦),MacOS,FreeBSD,Solaris,Windows(select的原因,不支援高效能並發)。 2.2 Linux核心要求

2.6及以上版本(uname –a 查看核心版本) 2.3 必備軟體

GCC編譯器:編譯工具。如果沒有,請yum install –y gcc進行下載安裝

PCRE庫:Regex的支援,如果不需要,可以不安裝。yum install –y pcre pcre-devel

Zlib庫:對HTTP包的內容做gzip的壓縮,如果不需要,可以不安裝。Yum install –y zlib zlib-devel

OpenSSL:對SSL協議的支援,如果不需要,可以不安裝。Yum install –y openssl openssl-devel 2.4 nginx下載安裝

從nginx官網下載nginx源碼。www.nginx.org

安裝:

./configure

make

make install

預設情況安裝到/usr/local/nginx目錄下。

運行:

cd /usr/local/nginx

./nginx

訪問測試:

curl http://localhost如果能正常看到html的頁面資料,Welcometo nginx,就表示成功了。

 

<待續>

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.