在 nginx 后面访问 plotly dash 的问题

Issue accessing plotly dash behind nginx

我在 VM 上有一个破折号 运行,IP 地址为 192.168.8.3,端口为 5050。在本地,我可以使用 url http://192.168.8.3:5050.

现在我正尝试在 http://myserver.com/dashboard/devs 上启用通过 Nginx 的访问。但是,当我尝试访问它时,在浏览器控制台中找不到一些文件:

GET http://myserver.com/assets/header.css?m=1597279663.0
GET http://myserver.com/assets/typography.css?m=1597279663.0

这是我的 nginx 配置:

server {
    server_name myserver.com;
    
    location /dashboard/devs {
        rewrite ^/(dashboard/devs)/(.*) / break;
        proxy_pass http://192.168.8.3:5050;
        proxy_set_header X-Real_IP $remote_addr
        ...
        proxy_set_header Host $http_host;
        proxy_redirect off;
    }
}

最后使用 flask 将“/”请求重定向到“/dashboard/devs/”解决了这个问题。 nginx 配置保持不变。