Deploying Pyramid app: Nginx + Pserve

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:

  |----env/ # virtualenv

This is my app.conf:

upstream myapp-site {

server {


    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;

Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

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.

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.

Search your nginx config files for “/etc/nginx/html/”. Something in the config file is pointing there, and that location apparently doesn’t exist.
<br>The connection refused error sounds like your app isn’t running. Did you start it?

I checked out the error logs using tail /var/log/nginx/error.log, and there are plenty of these errors: <br> <br>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: “” <br> <br>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: “” <br> <br>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.