upstream <%= fetch(:application) %> { server unix:/tmp/<%= fetch(:application) %>.sock fail_timeout=0; } server { listen 80; server_name <%= fetch(:server_address) %>; root <%= fetch(:deploy_to) %>/current/public; try_files $uri/index.html $uri @<%= fetch(:application) %>; location ~* ^(/assets|/favicon.ico) { access_log off; expires max; } location @<%= fetch(:application) %> { proxy_set_header X-Forwarded-Proto $scheme; proxy_set_header X-Forwarded-Ssl on; proxy_set_header X-Forwarded-Port 443; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header Host $http_host; proxy_redirect off; proxy_buffering on; proxy_set_header X-Real-IP $remote_addr; proxy_pass http://<%= fetch(:application) %>; } error_page 500 502 503 504 /500.html; client_max_body_size 1G; keepalive_timeout 10; }