您的位置:首页 > 运维架构 > 反向代理

反向代理例子

2020-06-10 04:43 465 查看

环境

客户端:	 10.0.0.1
反向代理: 10.0.0.5   172.16.1.5
后端节点: 10.0.0.7   172.16.1.7

配置后端的节点

[root@web01 ~]# cat /etc/nginx/conf.d/web.oldxu.com.conf
server {
listen 8080;
server_name web.oldxu.com;
root /web;

location / {
index index.html;
}
}
重启
[root@web01 ~]# systemctl reload nginx

配置反向代理

[root@lb01 ~]# gzip /etc/nginx/conf.d/default.conf
[root@lb01 ~]# cat /etc/nginx/conf.d/proxy_web.oldxu.com.conf
server {
listen 80;
server_name web.oldxu.com;

location / {
proxy_pass http://10.0.0.7:8080;
}
}
重启、设定开机自启
[root@lb01 ~]# systemctl start nginx
[root@lb01 ~]# systemctl enable nginx
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: