怎樣在CentOS下安裝Nginx

來源:互聯網
上載者:User

簡單介紹如何在 CentOS 下安裝 Nginx

工具/原料
  • 如果系統沒安裝 GCC 開發工具得先安裝,可以用下面的命令
    yum -y groupinstall "Development Tools"
步驟/方法
  1. 下載最新版本Nginx 網址 http://nginx.org/en/download.html

    wget http://nginx.org/download/nginx-0.8.53.tar.gz

  2. 解壓下載下好的源碼包

    tar zxvf nginx-0.8.53.tar.gz

  3. 進入解壓出的源碼檔案夾

    cd nginx-0.8.53

  4. 配置nginx

    ./configure --prefix=/opt/nginx --with-http_stub_status_module

    解釋: --prefix 為安裝路徑,--with-為需要安裝的模組,具體可以運行 ./configure --help 查看有效模組

  5. 編譯並安裝 nginx 
    make && make install
  6. 啟動 nginx

    /opt/nginx/sbin/nginx

  7. 停止 nginx

    /opt/nginx/sbin/nginx -s stop

  8. 重載 nginx

    /opt/nginx/sbin/nginx -s reload

參考資料

官方文檔

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.