环境:CentOS7+Nginx1.9.3
1安装依赖的类库
[root@localhost ~]# yum install zlib zlib-devel openssl openssl-devel pcre pcre-devel
2 下载nginx
[root@localhost ~]# wget http://nginx.org/download/nginx-1.9.4.tar.gz
3 安装nginx
[root@localhost src]# tar -zxvf nginx-1.9.4.tar.gz -C /src [root@localhost src]# cd nginx-1.9.4/ [root@localhost nginx-1.9.4]# ./configure --prefix=/usr/local/nginx --with-http_stub_status_module [root@localhost nginx-1.9.4]# make && make install
4 nginx 启动
[root@localhost nginx-1.9.4]# /usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf
5 开始firewall端口服务
firewall-cmd --permanent --zone=public --add-service=http
6 nginx 常用命令
/usr/local/nginx/sbin/nginx -s reload /usr/local/nginx/sbin/nginx -s stop /usr/local/nginx/sbin/nginx -t -c /usr/local/conf/nginx.cnf