Django + Uwsgi + Nginx 静态文件 404 502 问题解决
Nginx配置文件加上:
upstream django { ip_hash; server 127.0.0.1:[你的端口]; } #中间内容省略 #Django location /{ #宝塔默认uwsgi_params路径,手动安装Nginx用户自行查找 include /www/server/nginx/nginx/conf/uwsgi_params; uwsgi_pass 127.0.0.1:[你的端口]; #CDN获取真实IP uwsgi_param X-Real-IP $remote_addr; uwsgi_param X-Forwarded-For $proxy_add_x_forwarded_for; uwsgi_param X-Forwarded-Proto $http_x_forwarded_proto; } #注意这里!!!!!很关键!!!! location /static { alias /[你的项目]/static; }
备注一下,防止下一次搞忘
Django + Uwsgi + Nginx 静态文件 404 502 问题解决
https://blog.mxdyeah.top/mxdyeah_blog_post/50.html