upstream <%= fetch :application%> { server localhost:3000; } server { server_name <%= host.hostname %>; root /var/www/<%= fetch :application%>/current/public; location @<%= fetch :application%> { proxy_pass http://<%= fetch :application%>; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_read_timeout 90; } location / { try_files $uri @<%= fetch :application%> ; index index.html index.htm index.php; } location /status { stub_status on; allow all; } }