Django project nginx reverse proxy static file cannot be accessed

For the project of

django, direct command to run at 0.0.0.0 9090 is OK

nginx reverse proxy is used to access static resources of 127.0.0.1purl 9090.

my configuration is like this

        location / {
            proxy_pass http://127.0.0.1:9090;
            proxy_set_header Host $host;
            proxy_set_header X-Real-IP $remote_addr;
            proxy_set_header X-Forwarded-For $remote_addr;
            root /root/webvue/webvue;
            index  index.html index.htm;
        }
        location ~ ^/(static)/ {
            root /root/webvue/;
        }

the default configuration has been changed to these parts of server, nothing else has been moved, and the test configuration file is correct.
Baidu said that after reverse proxy, proxy_set_header Host $proxy_host is local by default for the requested Host, resulting in an error. It is still not possible for
to make the above settings.

excuse me, what is wrong with my setting and how should I change it? Thank you in advance!

Feb.28,2021
The

path is missing one level. Do you also need to use root/ root/webvue/webvue; under that static? Check error.log


under nginx. Problem solved, mark. The reverse proxy needs to specify the Host to access the static resource path. Read the log if you have any questions.

Menu