NGINX proxy_pass 404 资产

NGINX proxy_pass 404 for assets

提问人:Nick 提问时间:11/5/2023 更新时间:11/5/2023 访问量:13

问:

我在nginx的配置中使用有问题。proxy_pass

我有一个docker容器前端,在nginx中,当我访问localhost/frontend/时,我使用proxy_pass来显示这个容器。

除了所有资产之外,一切都正常 - 访问 localhost/frontend 时,图像是从 localhost/images 而不是 localhost/frontend/images 加载的。js 和 css 文件也是如此。

不幸的是,更改前端容器的代码对我来说不是一种选择。有没有解决方案如何将所有这些文件重定向到同一位置?

location /frontend/ {
        proxy_pass "http://frontend:3890/";
    }

尝试使用这个:

location /frontend/ {
        proxy_pass "http://frontend:3890/frontend/";
    }

但这无济于事

docker nginx http-status-code-404 资产

评论


答: 暂无答案