安装依赖库
yum install gc gcc gcc-c++ pcre-devel zlib-devel openssl-devel patch wget
创建访问用户组
groupadd nginx useradd -s /sbin/nologin -g nginx -M nginx
下载Nginx、Http Proxy connect 补丁
wget http://nginx.org/download/nginx-1.9.2.tar.gz wget https://github.com/chobits/ngx_http_proxy_connect_module/archive/master.zip
解压缩相应文件
tar -xzvf nginx-1.9.2.tar.gz unzip master.zip
配置编译:进入到解压后的Nginx安装文件内.
cd nginx-1.9.2
安装Connect补丁
patch -p1 < /path/to/ngx_http_proxy_connect_module/patch/proxy_connect.patch
说明:/path/to/ngx_http_proxy_connect_module/patch/proxy_connect.patch 为补丁所在目录.
补丁版本对应关系请参考作者主页:https://github.com/chobits/ngx_http_proxy_connect_module
编译安装
./configure --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_ssl_module --with-http_gzip_static_module --with-stream --add-module=/root/ngx_http_proxy_connect_module-master make && make install
[Unit]
Description=nginx - high performance web server
Documentation=http://nginx.org/en/docs/
After=network.target remote-fs.target nss-lookup.target
[Service]
Type=forking
PIDFile=/usr/local/nginx/logs/nginx.pid
ExecStartPre=/usr/local/nginx/sbin/nginx -t -c /usr/local/nginx/conf/nginx.conf
ExecStart=/usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf
ExecReload=/bin/kill -s HUP $MAINPID
ExecStop=/bin/kill -s QUIT $MAINPID
PrivateTmp=true
[Install]
WantedBy=multi-user.target
转载请注明:百尚 » 编译安装Nginx 并实现反向代理 HTTP Connect方式请求