Deploying Pyramid app: Nginx + Pserve

Posted April 21, 2014 6.2k views
I've been following this recipe in the Pyramid Cookbook ( to try and deploy my app on DigitalOcean. It seems to work, I get the message ``Entering daemon mode`` just like I did when running on my local machine. I've also added my domain name and set up my nameservers to point to DigitalOcean. When I try to access my site at though, it doesn't load. I'm completely lost at this point -- What am I doing wrong? This is how my files are structured: home/ |----env/ # virtualenv |----MyApp/ | |----production.ini |----requirements.txt |----myapp.sql |----myapp.psql |----MyProject | |----scripts/ |----static/ |----templates/ | | | This is my app.conf: upstream myapp-site { server; server; } server { server_name; access_log /home/myapp/access.log; location / { proxy_set_header Host $http_host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto $scheme; client_max_body_size 10m; client_body_buffer_size 128k; proxy_connect_timeout 60s; proxy_send_timeout 90s; proxy_read_timeout 90s; proxy_buffering off; proxy_temp_file_write_size 64k; proxy_pass http://myapp-site; proxy_redirect off; } location /static { root /home/MyApp; expires 30d; add_header Cache-Control public; access_log off; } }

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Submit an Answer
5 answers
There doesn't seem to be anything listening on port 80 -- is nginx running?
sudo netstat -plutn | grep nginx

sudo service nginx start
Yes, I forgot to deploy it yesterday.

This is what I get with sudo netstat -plutn | grep nginx
tcp 0* LISTEN 24042/nginx

Now something is loading, but its a 404 error:
I checked out the error logs using tail /var/log/nginx/error.log, and there are plenty of these errors:

2014/04/22 01:24:18 [error] 25568#0: *11 "/etc/nginx/html/index.html" is not found (2: No such file or directory), client:, server:, request: "GET / HTTP/1.1", upstream "", host: ""

2014/04/22 02:12:13 [error] 25792#0: *1 connect() failed (111: Connection refused) while connecting to upstream, client:, server:, request: "GET / HTTP/1.1", upstream "", host: ""

Why is it trying to get to /etc/nginx/html/index.html? Clearly my knowledge of VPS and app deployment is really lacking, and I appreciate the help.
Search your nginx config files for "/etc/nginx/html/". Something in the config file is pointing there, and that location apparently doesn't exist.
The connection refused error sounds like your app isn't running. Did you start it?
Thanks for the help everyone, I figured it out partially, it was mostly a database issue. I now have another problem where the HTML loads fine, but the static assets are not found, but I'll create another thread for that.