1.采用多个端口配置不同的静态资源
http { server { listen 8001; server_name example1.com;
location /static1 {
root /path/to/static1;
}
}
server {
listen 8002;
server_name example2.com;
location /static2 {
root /path/to/static2;
}
}
}
- 反向代理
server { listen 8091;
location / {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header REMOTE-HOST $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
add_header Cache-Control "max-age=no-cache";
proxy_pass http://localhost:8090;
}
location /serve {
proxy_pass http://localhost:8090;
}
location /wx {
proxy_pass http://localhost:8083;
}
}
8091 8090 8091/serve 8090/serve 8091/wx 8083/wx