首页 > django+gunicorn+nginx部署问题

django+gunicorn+nginx部署问题

nginx配置

server {
    listen 80;
    server_name example.org;
    access_log  /var/log/nginx/example.log;

    location / {
        proxy_pass http://127.0.0.1:8000;
        proxy_set_header Host $host;
        proxy_redirect off;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    }
    location /static/ {
        root /root/blog/mysite;
    }
}

~
~
~
~
django部署的目录是/root/blog/mysite
静态文件目录/root/blog/mysite/static/css/blog.css
请问为什么不能使用静态文件


额,问题解决了,主要是权限不足,将django项目从root迁移到home目录,就可以访问静态文件。谢谢各位的指导


location /static/ {

    root /root/blog/mysite/static;
}

貌似应该定位到static文件夹下


static 放上面

【热门文章】
【热门文章】