upstream puma { server unix:/usr/src/app/tmp/sockets/fablab.sock fail_timeout=0; } server { listen 80; server_name capsciences.fab-manager.com; root /usr/src/app/public; location ^~ /assets/ { gzip_static on; expires max; add_header Cache-Control public; } try_files $uri/index.html $uri @puma; location @puma { proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header Host $http_host; proxy_redirect off; proxy_pass http://puma; } client_max_body_size 4G; keepalive_timeout 10; error_page 500 502 503 504 /500.html; error_page 503 @503; # Return a 503 error if the maintenance page exists. if (-f /usr/src/app/public/maintenance.html) { return 503; } location @503 { # Serve static assets if found. if (-f $request_filename) { break; } # Set root to the shared directory. root /usr/src/app/public; rewrite ^(.*)$ /maintenance.html break; } }