標籤: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