uwsgi - Can't figure out how to serve static files with Nginx -


i have followed tutorial found here , when trying access static files page not found error. here tutorial following https://gist.github.com/evildmp/3094281

this in error log file nginx. 2013/07/17 09:55:15 [emerg] 2891#0: "upstream" directive not allowed here in /etc/nginx/nginx.conf:2

and nginx conf file

# nginx.conf upstream django { # connect socket # server unix:///tmp/uwsgi.sock;    # file socket server 127.0.0.1:8000;      # web port socket 8001 }  server { # port site served on listen      8000; # domain name serve server_name inventory.ien.gatech.edu;   # substitute machine's ip address or fqdn charset     utf-8;  #max upload size client_max_body_size 75m;   # adjust taste   # django media location /media  {             alias /desktop/projects/newest/ien_inventory/inventory/templates/media;      # django project's media files }      location /static {             alias /desktop/projects/newest/ien_inventory/inventory/templates/media;    # django project's static files     }  # finally, send non-media requests django server. location / {     uwsgi_pass  django;     include     /etc/nginx/uwsgi_params; # or uwsgi_params installed manually     } } 

thanks or advice.

you're missing http block. upstream , server block need wrapped http block. final file this.

edit: i've added in defaults supplied /etc/nginx/nginx.conf

worker_process = 1;  events {     worker_connections 1024; }  http {     include mime.types.default;     # server_tokens off;    # optional      # sendfile on;          # optional     # keepalive_timeout 100;# optional     # tcp_nodelay on;       # optional       # nginx.conf     upstream django {         # connect socket         # server unix:///tmp/uwsgi.sock;    # file socket         server 127.0.0.1:8000;      # web port socket 8001     }      server {         # port site served on         listen      8000;         # domain name serve         server_name server.servername.com;   # substitute machine's ip address or fqdn         charset     utf-8;          #max upload size         client_max_body_size 75m;   # adjust taste           # django media          location /media  {             alias /desktop/projects/newest/inventory/inventory/templates/media;      # django project's media files          }           location /static {             alias /desktop/projects/newest/inventory/inventory/templates/media;    # django project's static files         }          # finally, send non-media requests django server.         location / {             uwsgi_pass  django;             include     /etc/nginx/uwsgi_params; # or uwsgi_params installed manually             }         }   } 

Comments

Popular posts from this blog

php - Calling a template part from a post -

Firefox SVG shape not printing when it has stroke -

How to mention the localhost in android -