nginx-proxy-manager icon indicating copy to clipboard operation
nginx-proxy-manager copied to clipboard

Django Static files serving

Open saelozahra opened this issue 2 years ago • 3 comments

Hello Dear friends

I used to use nginx with the following settings in the nginx.conf file to serve the Django sites


upstream fars_habitat {
    server fars_habitat:9000;
}

client_max_body_size 50M;

server {
    listen 80;
    server_name zistboom.farhangi-fars.com www.zistboom.farhangi-fars.com;
    access_log /var/log/nginx/access.log;
    error_log /var/log/nginx/errorr.log;
    root /usr/share/nginx/html;
    index index.html index.htm;

    location / {
        proxy_pass http://fars_habitat;
        proxy_redirect  off;
        proxy_set_header    Host $host;
        proxy_set_header    X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header    X-Forwarded-Host $server_name;
        proxy_set_header    X-Real_IP   $remote_addr;
    }

    location /static/ {
        alias /fars_habitat/static/;
    }

    location /files/ {
        alias /fars_habitat/;
    }

}

And the site was working well

But yesterday I migrated to NginxProxyManager

But in static files, get 404 error


I applied the following settings

photo_۲۰۲۳-۰۱-۲۴_۱۶-۳۶-۱۷ photo_2023-01-24_16-36-19

Apparently, the locations section is not set correctly

It is possible to guide me to apply the following settings

    location /static/ {
        alias /fars_habitat/static/;
    }

    location /files/ {
        alias /fars_habitat/;
    }

in NginxProxyManager ؟

saelozahra avatar Jan 24 '23 13:01 saelozahra

🤔

saelozahra avatar Apr 07 '23 23:04 saelozahra

any solution?

talhaanwarch avatar Jul 19 '23 04:07 talhaanwarch

Issue is now considered stale. If you want to keep it open, please comment :+1:

github-actions[bot] avatar Jan 29 '24 01:01 github-actions[bot]