我想在我的 VPS 上为我的 Heroku 应用程序(http://lovemaple.heroku.com)设置一个反向代理所以如果我访问mysite.com/blog我可以在http://lovemaple.heroku.com 中获取内容
我按照Apache wiki上的说明进行操作。
location /couchdb {
rewrite /couchdb/(.*) /$1 break;
proxy_pass http://localhost:5984;
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
Run Code Online (Sandbox Code Playgroud)
我改变了它以适应我的情况:
location /blog {
rewrite /blog/(.*) /$1 break;
proxy_pass http://lovemaple.heroku.com;
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
Run Code Online (Sandbox Code Playgroud)
当我访问时mysite.com/blog,页面显示出来,但无法获取 js/css 文件(404)。
他们的链接变为mysite.com/style.css但不是mysite.com/blog/style.css。
出了什么问题,我该如何解决?