innvent/matross

View on GitHub
lib/matross/templates/nginx/nginx_virtual_host_conf.erb

Summary

Maintainability
Test Coverage
upstream <%= application %> {
  server unix:/tmp/unicorn.<%= application %>.sock fail_timeout=0;
}

server {
    listen 80<%= ' default_server' if nginx_default_server %>;
    client_max_body_size 50m;
    server_name <%= server_name %>;

    keepalive_timeout 5;
    root <%= deploy_to %>/current/public;
    try_files $uri @<%= application %>;

    location @<%= application %> {
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header Host $http_host;
        proxy_redirect off;
        proxy_pass http://<%= application %>;
    }

    location ~ ^/(assets)/  {
        gzip_static on;
        expires max;
        add_header Cache-Control public;
    }

    error_page 500 502 504 /500.html;
    location = /500.html {
        root <%= deploy_to %>/current/public;
    }
}