【发布时间】:2015-01-10 15:31:13
【问题描述】:
我有一个在域(例如 example.com)上运行的基本 html 站点,我想在子目录(例如:example.com/test)中运行烧瓶应用程序 烧瓶应用程序使用默认烧瓶开发服务器在端口 5433 上运行。
我使用下面的nginx配置来实现这个
location /test {
rewrite /test(.*) $1 break;
proxy_pass http://localhost:5433;
proxy_redirect default;
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 /static/{
alias /home/hrishi/www/example.com/test/app/static/;
}
我可以使用 example.com/test/ url 访问应用程序,但静态文件无法加载(出现 404 错误),尽管有别名。
我该如何解决这个问题?
【问题讨论】:
-
这不是子域。我的子域在你的域名之前开始。在您的情况下,它将是 test.exemple.com。在这种情况下,它永远不会起作用。