nginx - Nginx + Gunicorn + Flask 静态资产 404
问题描述
我想使用 Nginx 使 {host1}/v2 代理传递到另一个 IP。
我的 Nginx 和 Gunicorn 在不同的两台服务器上
这是我的配置:
location /v2 {
proxy_pass http://127.0.0.1:7777/;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
我的 Gunicorn 命令:
gunicorn -b 0.0.0.0:7777 -w 1 autoapp:app
它有效,但未找到 Flask 静态响应 404。
静态网址是http://{host}/static
我该如何配置?谢谢:-)
解决方案
我解决了!
{host}/v2/static
能行得通。
我使用Flask-Webpack
了扩展名。
所以只需配置这个参数
WEBPACK_ASSETS_URL = '/v2/static/'
推荐阅读
- javascript - 按属性 JS/Jquery 对 Dom 元素进行排序
- azure-storage-files - 您如何使用 dask-kubernetes 在 Dask 工作人员上挂载卷?
- javascript - 使用 typescript/javascript 将数组拆分为组
- mongodb - Mongodb Timeseries 数据架构设计
- asp.net - IIS 在浏览站点时将 IE11 文档模式从 11(默认)更改为 7(默认)
- machine-learning - 无法从“sklearn.ensemble”导入名称“StackingClassifier”
- ios - Xamarin.Ios 未部署到 iphone-simulator
- angular - 使用角度材料表进行多文本搜索
- jmeter - Jmeter响应时间混乱,在负载测试中我需要考虑什么时间作为响应时间
- twitter-bootstrap - Bootstrap Modal 向具有“is-fixed”类的元素添加填充权