{% if be_app_repo is defined %} upstream unicorn { server unix:{{unicorn_sockfile}} fail_timeout=0; } {% endif %} server { listen 80 default deferred; # server_name example.com; {% if fe_app_local_path is defined%} root {{ fe_app_path }}/dist; {% else %} root {{ be_app_path }}/public; {% endif %} if (-f $document_root/system/maintenance.html) { return 503; } error_page 503 @maintenance; location @maintenance { rewrite ^(.*)$ /system/maintenance.html last; break; } location ^~ /assets/ { gzip_static on; expires max; add_header Cache-Control public; } {% if be_app_repo is defined %} try_files $uri/index.html $uri @unicorn; location @unicorn { proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header Host $http_host; proxy_redirect off; proxy_pass http://unicorn; } {% endif %} error_page 500 502 503 504 /500.html; client_max_body_size 4G; keepalive_timeout 10; if (-f $document_root/system/maintenance.html) { return 503; } error_page 503 @maintenance; location @maintenance { rewrite ^(.*)$ /system/maintenance.html last; break; } }