首页 > 其他 > 详细

nginx 多级7层代理安装配置

时间:2019-05-18 16:43:32      阅读:98      评论:0      收藏:0      [点我收藏+]

编译安装

yum install zlib-devel -y

wget https://nginx.org/download/nginx-1.15.12.tar.gz

tar -zxf nginx-1.15.12.tar.gz

./configure --with-stream --prefix=/usr/local/nginx-1.15.12

make && make install


cd /usr/local/ && ln -s nginx-1.15.12 nginx


启动脚本


cat > /etc/systemd/system/nginx.service <<EOF
[Unit]
Description=nginx proxy
After=network.target
After=network-online.target
Wants=network-online.target

[Service]
Type=forking
ExecStartPre=/usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf -p /usr/local/nginx -t
ExecStart=/usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf -p /usr/local/nginx
ExecReload=/usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf -p /usr/local/nginx -s reload
PrivateTmp=true
Restart=always
RestartSec=5
StartLimitInterval=0
LimitNOFILE=65536

[Install]
WantedBy=multi-user.target
EOF



多级代理配置

重点需将 http_host 变量传递至后端,否则可能到第二级代理会找不到资源。

proxy_set_header Host $http_host;

proxy_set_header Connection close;

nginx 多级7层代理安装配置

原文:https://www.cnblogs.com/bugbeta/p/10886134.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!