Skip to content

Instantly share code, notes, and snippets.

@papucho
Created August 3, 2013 16:41
Show Gist options
  • Save papucho/6147073 to your computer and use it in GitHub Desktop.
Save papucho/6147073 to your computer and use it in GitHub Desktop.

Revisions

  1. papucho created this gist Aug 3, 2013.
    35 changes: 35 additions & 0 deletions nginx
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,35 @@
    upstream my_app {
    server unix:///tmp/my_app.sock;
    }

    server {
    listen *:80;
    server_name my_app.com;

    access_log /var/log/nginx/my_app-access.log;

    location /favicon.ico {
    root /var/www/my_app/public/assets/favicon.ico;
    gzip_static on;
    expires max;
    add_header Cache-Control public;
    }

    location / {
    root /var/www/my_app/public;
    try_files $uri @app;
    gzip_static on;
    expires max;
    add_header Cache-Control public;
    }

    location @app {
    proxy_pass http://my_app;
    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 https;
    proxy_set_header Host $http_host;
    proxy_redirect off;
    proxy_next_upstream error timeout invalid_header http_502;
    }
    }