怎么让Nginx可以访问某一IP的每个后台controller接口
http {
upstream backend {
server 192.168.1.10; # 后端服务器IP
}
server {
listen 80;
location /controller1/ {
##proxy_pass http://localhost:801;
proxy_pass http://backend/controller1/; # 后端controller1接口
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
location /controller2/ {
proxy_pass http://backend/controller2/; # 后端controller2接口
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
# 其他location或配置...
}
}