1、安装prce(重定向支持)和openssl(https支持,如果不需要https可以不安装)
#yum -y install pcre*
#yum -y install openssl*
2、下载nginx 1.7.8
#wget http://nginx.org/download/nginx-1.7.8.tar.gz
3、解压编译安装
#tar -zxvf nginx-1.7.8.tar.gz
#cd nginx-1.7.8
#./configure --prefix=/usr/local/nginx-1.7.8 \
--with-http_ssl_module --with-http_spdy_module \
--with-http_stub_status_module --with-pcre
如果没有error信息,就可以执行下边的安装了:
#make
#make install
4、开启nginx进程
#/usr/local/nginx-1.7.8/sbin/nginx
重启或关闭进程:
#/usr/local/nginx-1.7.8/sbin/nginx -s reload
#/usr/local/nginx-1.7.8/sbin/nginx -s stop
5、关闭防火墙,或者添加防火墙规则就可以测试了
#service iptables stop
或者编辑配置文件:
#vi /etc/sysconfig/iptables
添加这样一条开放80端口的规则后保存:
-A INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT
重启服务即可:
#service iptables restart
ok,,可以浏览器访问了。
http://service_ip
6、nginx配置信息位置
/usr/local/nginx-1.5.1/conf
网友评论