centos下安裝nginx

來源:互聯網
上載者:User

標籤:style   blog   http   io   color   ar   os   sp   div   

1、下載穩定版本的nginx. http://nginx.org/en/download.html

2、按照如下命令安裝

#檢查系統路徑[[email protected] usr]# pwd/usr#解壓到當前路徑[[email protected] usr]# tar -zxv -f nginx-1.6.2.tar.gz #刪除壓縮包[[email protected] usr]# rm -rf nginx-1.6.2.tar.gz #進入到解壓包下[[email protected] usr]# cd nginx-1.6.2/[[email protected] nginx-1.6.2]# #指定安裝路徑[[email protected] nginx-1.6.2]# ./configure --prefix=/usr/local/nginx#編譯[[email protected] nginx-1.6.2]# make#安裝[[email protected] nginx-1.6.2]# make install#回退到解壓縮包上級目錄[[email protected] usr]# cd ../#解除解壓縮包[[email protected] usr]# rm nginx-1.6.2 -rf

3、安裝缺少包提示

錯誤提示 ./configure: error: the HTTP rewrite module requires the PCRE library.You can either disable the module by using --without-http_rewrite_moduleoption, or install the PCRE library into the system, or build the PCRE librarystatically from the source with nginx by using --with-pcre=<path> option.解決方案[[email protected] nginx-1.6.2]# yum -y install pcre-devel
錯誤提示 ./configure: error: the HTTP gzip module requires the zlib library.You can either disable the module by using --without-http_gzip_moduleoption, or install the zlib library into the system, or build the zlib librarystatically from the source with nginx by using --with-zlib=<path> option.解決方案[[email protected] nginx-1.6.2]# yum install -y zlib-devel
錯誤提示:./configure: error: the HTTP cache module requires md5 functionsfrom OpenSSL library.   You can either disable the module by using--without-http-cache option, or install the OpenSSL library into the system,or build the OpenSSL library statically from the source with nginx by using--with-http_ssl_module --with-openssl=<path> options.解決方案[[email protected] nginx-1.6.2]# yum  -y install openssl openssl-devel

4、修改防火牆配置:

#修改防火牆配置:[[email protected] nginx]# vi + /etc/sysconfig/iptables#添加配置項-A INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT#重啟防火牆
[[email protected] nginx]# service iptables restart

5、啟動nginx

#方法1
[[email protected] nginx]# /usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf 

#方法2
[[email protected] nginx]# cd /usr/local/nginx/sbin [[email protected] sbin]# ./nginx

6、查看nginx是否啟動

[[email protected] nginx]# netstat -ntlp

或者

#測試連接埠[[email protected] nginx]# netstat –na|grep 80
#瀏覽器中測試http://ip:80

 附錄:

#查詢nginx主進程號[[email protected] sbin]# ps -ef | grep nginx#停止進程[[email protected] sbin]# kill -QUIT 主進程號#快速停止[[email protected] sbin]# kill -TERM 主進程號#強制停止[[email protected] sbin]# pkill -9 nginx

轉載請註明出處:[http://www.cnblogs.com/zhoulf/archive/2013/02/09/2909653.html]

centos下安裝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.