Nginx部署
1、环境准备
[[email protected]~]# yum install pcre* openssl*
注明:
pcre ---> 支持rewrite功能
openssl* ---> 需要ssl的支持
2、安装nginx
[[email protected]]# tar zxf nginx-1.6.3.tar.gz
[[email protected] nginx-1.6.3]# ./configure\
>--prefix=/usr/local/nginx \
>--with-http_ssl_module \ 支持https
>--with-http_spdy_module \
>--with-http_stub_status_module \ 支持nginx状态查询
>--with-pcre 支持rewrite重写
[[email protected]]# make
[[email protected]]# make install
3、启动nginx
[[email protected] ~]# /usr/local/nginx/sbin/nginx
[[email protected] ~]# netstat -ntulp | grep 80
tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 29900/nginx
4、nginx关闭
[[email protected] ~]# /usr/local/nginx/sbin/nginx -s stop
nginx reload(重置出错)
[[email protected] ~]# /usr/local/nginx/sbin/nginx -s reload
nginx: [error] open()"/usr/local/nginx/logs/nginx.pid" failed (2: No such file ordirectory)
解决办法:
[[email protected] ~]# /usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf