nginx的安装
1.下载nginx安装包(https://nginx.org/download/nginx-1.8)
2.安装必要的环境
yum install gcc-c++
yum install -y pcre pcre-devel
yum install -y zlib zlib-devel
yum install -y openssl openssl-devel
3.在nginx的根目录执行
./configure \
--prefix=/usr/local/nginx \
--pid-path=/var/run/nginx/nginx.pid \
--lock-path=/var/lock/nginx.lock \
--error-log-path=/var/log/nginx/error.log \
--http-log-path=/var/log/nginx/access.log \
--with-http_gzip_static_module \
--http-client-body-temp-path=/var/temp/nginx/client \
--http-proxy-temp-path=/var/temp/nginx/proxy \
--http-fastcgi-temp-path=/var/temp/nginx/fastcgi \
--http-uwsgi-temp-path=/var/temp/nginx/uwsgi \
--http-scgi-temp-path=/var/temp/nginx/scgi
4.编译,安装
make install
测试配置文件
ngixn -t
启动nginx
在/usr/local/nginx/sbin下,命令:./nginx
关闭nginx
命令:ps -ef|grep nginx
kill -QUIT 进程号
或者:nginx -s quit
重启nginx
在/usr/local/nginx/sbin下,命令:./nginx -s reload