- 下载Nginx
wget http://nginx.org/download/nginx-1.15.8.tar.gz
tar -xzf nginx-1.15.8.tar.gz
- 安装编译组件
yum install gcc gcc-c++ automake pcre pcre-devel zlip zlib-devel openssl openssl-devel
- 下载插件
yum install mercurial //需要 mercurial 客户端
hg clone http://hg.nginx.org/njs
- 配置编译选项
./configure \
--prefix=/usr/local/nginx \
--sbin-path=/usr/local/nginx/sbin/nginx \
--conf-path=/usr/local/nginx/conf/nginx.conf \
--error-log-path=/var/log/nginx/error.log \
--http-log-path=/var/log/nginx/access.log \
--pid-path=/var/run/nginx/nginx.pid \
--lock-path=/var/lock/nginx.lock \
--user=nginx \
--group=nginx \
--with-http_ssl_module \
--with-http_stub_status_module \
--with-http_gzip_static_module \
--http-client-body-temp-path=/var/tmp/nginx/client/ \
--http-proxy-temp-path=/var/tmp/nginx/proxy/ \
--http-fastcgi-temp-path=/var/tmp/nginx/fcgi/ \
--http-uwsgi-temp-path=/var/tmp/nginx/uwsgi \
--http-scgi-temp-path=/var/tmp/nginx/scgi \
--with-pcre \
--add-module=/${njs_parrent_dir_path}/njs/nginx
- 编译安装
make && make install
- 配置环境变量
ln -s /usr/local/nginx/sbin/nginx /usr/local/bin/