CentOS-6.4安裝配置Nginx

來源:互聯網
上載者:User

標籤:http   os   ar   檔案   art   sp   on   c   ad   

在安裝nginx前,需要確保系統安裝了g++、gcc、openssl-devel、pcre-devel和zlib-devel軟體。安裝必須軟體:
[[email protected] /]#yum install gcc-c++
yum -y install zlib zlib-devel openssl openssl--devel pcre pcre-devel

檢查系統安裝的Nginx:

[[email protected] local]# find -name nginx

卸載原有的Nginx

[[email protected] /]# yum remove nginx
安裝

將安裝包檔案上傳到/usr/local中執行以下操作:

[[email protected] src]# tar -zxv -f nginx-1.6.2.tar.gz
[[email protected] nginx-1.6.2]# ./configure
[[email protected]  nginx-1.6.2]# make
[[email protected]  nginx-1.6.2]# make install

配置

#修改防火牆配置:
[[email protected] nginx-1.6.2]# vi + /etc/sysconfig/iptables
#添加配置項
-A INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT
#重啟防火牆
[[email protected] nginx-1.6.2]# service iptables restart
啟動
#方法1
[[email protected] nginx-1.6.2]# /usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf
#方法2
[[email protected] nginx-1.2.6]# cd /usr/local/nginx/sbin
[[email protected] sbin]# ./nginx
停止
#查詢nginx主進程號
ps -ef | grep nginx
#停止進程
kill -QUIT 主進程號
#快速停止
kill -TERM 主進程號
#強制停止
pkill -9 nginx
重啟
[[email protected] local]# /usr/local/nginx/sbin/nginx -s reload
測試

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

CentOS-6.4安裝配置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.