当公司只存在一个公网地址时候,需要影射多个域名,并且域名下面要配置二级目录的时候
可以参照如下配置
upstream h5_game {
server 10.0.100.153:80;
}
server{
listen 3116;
server_name www.xxx.com;
location / {
proxy_pass http://h5_game;
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 /big/ {
proxy_pass http://10.0.100.153:80/big/;
}
location /small/ {
proxy_pass http://10.0.100.153:80/small/;
}
}
访问地址:www.xxx.com/big www.xxx.com/small,可以直接访问后端服务器的耳机域名