环境
客户端: 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.qwe.com.conf
server {
listen 8080;
server_name web.qwe.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.qwe.com.conf
server {
listen 80;
server_name web.qwe.com;
location / {
proxy_pass http://10.0.0.7:8080;
}
}
重启、设定开机自启
[root@lb01 ~]# systemctl start nginx
[root@lb01 ~]# systemctl enable nginx