upstream <%= app_name %> { server unix:/tmp/<%= app_name %>.sock; } server { listen 80; server_name <%= @server_name %>; root <%= rails_root %>/public; try_files $uri/index.html $uri @app; location @app { proxy_pass http://<%= app_name %>; 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; } <% if @rails_env == 'production' -%> location ~ ^/(assets)/ { gzip_vary on; gzip_static on; expires 1y; add_header Cache-Control public; add_header ETag ""; } <% end -%> }