- 安装依赖
yum -y install pcre-devel
yum -y install zlib-devel
- 配置参数
./configure --prefix=/home/pch/nginx \
--pid-path=/home/pch/nginx/pid/nginx.pid \
--lock-path=/home/pch/nginx/lock/nginx.lock \
--error-log-path=/home/pch/nginx/log/error.log \
--http-log-path=/home/pch/nginx/log/access.log \
--with-http_gzip_static_module \
--http-client-body-temp-path=/home/pch/nginx/temp/client \
--http-proxy-temp-path=/home/pch/nginx/temp/proxy \
--http-fastcgi-temp-path=/home/pch/nginx/temp/fastcgi \
--http-uwsgi-temp-path=/home/pch/nginx/temp/uwsgi \
--http-scgi-temp-path=/home/pch/nginx/temp/scgi
注:根据实际安装路径修改
- 编译安装
make && make install
- 环境变量
export NGINX_HOME=/home/pch/nginx
export PATH=$PATH:$NGINX_HOME/sbin
- nginx命令
nginx #启动
nginx -s stop #停止
nginx -s reload #重启