mardi 14 avril 2015

Trouble getting nginx to serve 'media' files

I've been working through a turotial and got stuck at this specific part and can't seem to figure it out. This is exactly where I am stuck.


Here is my 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
}
}


Here is the file structure of mysite on pastebin - Sorry for it being a total mess. I am aware of redundant static files. If you need any other files, I am happy to provide. Thank you.





Aucun commentaire:

Enregistrer un commentaire