一、安裝說明 系統環境:CentOS-6.3 軟件:nginx-1.9.0.tar.gz 安裝方式:源碼編譯安裝 安裝位置:/usr/local/src/nginx_1.9.0 下載地址:http://nginx.org/en/download.htmlhtml
二、安裝前提 在安裝nginx前,須要確保系統安裝了g++、gcc、openssl-devel、pcre-devel和zlib-devel軟件。安裝必須軟件: 安裝命令以下: [root@localhost /]# yum install gcc-c++ [root@localhost /]# yum -y install zlib zlib-devel openssl openssl--devel pcre pcre-develnginx
檢查系統安裝的Nginx: [root@localhost /]# find -name nginx ./usr/local/src/nginx_1.9.0/sbin/nginxc++
卸載原有的Nginx: [root@localhost /]# yum remove nginx瀏覽器
三、安裝 將安裝包文件上傳到 /usr/local/src/中執行如下操做: [root@localhost /]# cd /usr/local/src [root@localhost src]# tar -zxvf nginx-1.9.0.tar.gz [root@localhost src]# rm -rf nginx-1.2.6.tar.gz [root@localhost src]# cd /usr/local/src/nginx-1.9.0 [root@localhost nginx_1.9.0]# ./configure --prefix=/usr/local/nginx_1.9.0 [root@localhost nginx_1.9.0]# make && make installtcp
四、配置 進入修改防火牆配置: [root@localhost nginx_1.9.0]# vi /etc/sysconfig/iptables 添加配置項: -A INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT 重啓防火牆: [root@localhost nginx_1.9.0]# service iptables restart測試
五、啓動nginx [root@localhost nginx_1.9.0]# cd /usr/local/src/nginx_1.9.0/sbin [root@localhost sbin]# ./nginxrest
六、測試是否成功 瀏覽器中輸入測試地址: http://ip:80htm