我在配置nginx proxy_pass时遇到了问题。有这样的情况:
下面列出的配置:
server {
listen 80; ## listen for ipv4; this line is default and implied
location /app_a {
rewrite /app_a/(.*)$ /$1 break;
access_log off;
proxy_pass http://yy.yy.yy.yy/;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host $host;
proxy_set_header Client-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Upstream $remote_addr;
}
location /app_b {
rewrite /app_b/(.*)$ /$1 break;
access_log off;
proxy_pass http://zz.zz.zz.zz;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host $http_host;
proxy_set_header Client-IP $remote_addr;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header X-Upstream $remote_addr;
}
}
然后当我使用浏览器xx.xx.xx.xx / app_a或xx.xx.xx.xx / app_b时,没有加载静态文件(404),并且所有链接都没有应用程序前缀(xx.xx. XX.XX /登录)
我如何配置nginx以便链接显示如下: