41 lines
1.1 KiB
Plaintext

upstream <%= fetch(:nginx_upstream) %> {
server unix:///home/<%= fetch(:remote_user) %>/srv/thirteen-tien-len_<%= fetch(:stage) %>/shared/tmp/sockets/puma.sock fail_timeout=0;
}
server {
<% if fetch(:nginx_listen, false) %>
listen <%= fetch(:nginx_listen) %>;
<% end %>
server_name <%= fetch(:nginx_server_name) %>;
root <%= current_path.join('public') %>;
try_files $uri/index.html $uri.html $uri @<%= fetch(:nginx_upstream) %>;
location ^~ /assets/ {
gzip_static on;
expires max;
add_header Cache-Control public;
}
location @<%= fetch(:nginx_upstream) %> {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_redirect off;
proxy_pass http://<%= fetch(:nginx_upstream) %>;
}
if (-f $document_root/system/maintenance.html) {
return 503;
}
error_page 500 502 504 /500.html;
location = /500.html {
root <%= current_path.join('public') %>;
}
error_page 503 @maintenance;
location @maintenance {
rewrite ^(.*)$ /system/maintenance.html break;
}
}