【问题标题】:Nginx + Gunicorn + Flask static assets 404Nginx + Gunicorn + Flask 静态资产 404
【发布时间】:2018-07-25 11:53:50
【问题描述】:

我想使用 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

我该如何配置?谢谢:-)

【问题讨论】:

  • 你试过了吗http://{host}/v2/static
  • @ThanhNguyenVan 是的,它成功了!谢谢!

标签: nginx flask gunicorn


【解决方案1】:

我解决了!

{host}/v2/static 可以工作。

我使用了Flask-Webpack 扩展。

所以只需配置这个参数

WEBPACK_ASSETS_URL = '/v2/static/'

【讨论】:

    猜你喜欢
    • 2021-05-12
    • 2012-02-20
    • 2015-11-30
    • 1970-01-01
    • 2021-08-08
    • 2019-09-23
    • 1970-01-01
    • 2016-04-22
    • 1970-01-01
    相关资源
    最近更新 更多