【发布时间】:2022-02-15 14:56:27
【问题描述】:
我在nginx和uwsgi上使用Django Compressor
我有 nginx 和 uwsgi 的每个 docker 容器
我提前将静态文件夹复制到nginx:/static,其他复制到uwsgi:/myapp/。
但是compress.js动态压缩文件并设置在uwsgi容器的uwsgi:myapp/static/CACHE下。
<script src="/static/CACHE/js/output.b6723c2174c0.js">
因此没有找到这个文件的 404,因为这个请求被重定向到 nginx:/static 而不是uwsgi:/myapp/static
有人如何解决这个问题?
我的 nginx 设置如下
server {
listen 8000;
server_name 127.0.0.1;
charset utf-8;
location /static {
alias /static;
}
location / {
auth_basic "Restricted";
auth_basic_user_file /etc/nginx/.htpasswd;
proxy_pass http://uwsgi:8001/;
include /etc/nginx/uwsgi_params;
}
}
【问题讨论】:
-
你好白熊。你解决了吗?
标签: javascript django nginx