uwsgi nginx django ubuntu 14.04 virtualenv

413 Views Asked by At

I am trying to run my simple django project on uwsgi and nginx, I use ubuntu 14.04 server.

I have followed the uWSGI doc,since here it works ok,but when it comes to this part it won't work for me ,I do not know why?here is the mysite_nginx.conf:

# mysite_nginx.conf

# the upstream component nginx needs to connect to
upstream django {
    #server unix:///home/ubuntu/d18/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
    listen      8000;
    # the domain name it will serve for
    server_name 123.123.123.123; # this just my example IP address or FQDN
    charset     utf-8;

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

    # Django media
    location /media  {
        alias /path/to/your/mysite/media;  # your Django project's media files - amend as required
    }

    location /static {
        alias /path/to/your/mysite/static; # your Django project's static files - amend as required
    }

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

I did not do the "python manage.py collectstatic", because I thought I just wanna see the sample mysite run on the nginx and uwsgi, however it just not work. Can someone tell me why?

0

There are 0 best solutions below