无法让nginx提供“媒体”文件

时间:2015-04-14 09:07:56

标签: django web nginx uwsgi

我一直在做一个turotial并陷入这个特定的部分,似乎无法搞清楚。 This is exactly where I am stuck

这是我的mysite_nginx.conf

# mysite_nginx.conf
# the upstream component nginx needs to connect to
upstream django {
    # server unix:///path/to/your/mysite/mysite.sock; # for a file socket
    server 127.0.0.1:8001; # for a web port socket (we'll use this first)
}

# configuration of the server
server {
    # the port your site will be served on

    root / ;

    listen      8000;
    # the domain name it will serve for
    server_name .81.*.*.*; # substitute your machine's IP address or FQDN
    charset     utf-8;

    # max upload size
    client_max_body_size 75M;   # adjust to taste

    # Django media      

    location /media/ {
        root /home/mysite/mysite1/blog/media; # your Django project's static files - amend as required
    }
    # Django static
    location /static/ {
        #alias /home/mysite/mysite1/blog/templates;  # your Django project's media files - amend as required
        root /home/mysite/mysite1/blog/static;
    }



    # Finally, send all non-media requests to the Django server.
    location / {
        uwsgi_pass  django;
        include     /home/mysite/mysite1/uwsgi_params; # the uwsgi_params file you installed
    }
}

这是mysite on pastebin的文件结构 - 很抱歉这是一团糟。我知道冗余的静态文件。如果您需要任何其他文件,我很乐意提供。谢谢。

0 个答案:

没有答案
相关问题