upstream fablab_unicorn_staging { server unix:/tmp/unicorn.fablab_staging.sock fail_timeout=0; } server { listen 80; server_name fablab.sleede.com capsciences.sleede.com relais-sciences.sleede.com demo-premium.fab-manager.com; root /home/admin/apps/fablab_staging/current/public; #location / { # auth_basic "Restricted"; # auth_basic_user_file /home/admin/apps/fablab/.htpasswd; # proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; # proxy_set_header Host $http_host; # proxy_redirect off; # proxy_pass http://unicorn; #} location ^~ /assets/ { gzip_static on; expires max; add_header Cache-Control public; } try_files $uri/index.html $uri @fablab_unicorn_staging; location @fablab_unicorn_staging { proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header Host $http_host; proxy_redirect off; proxy_pass http://fablab_unicorn_staging; } client_max_body_size 4G; keepalive_timeout 10; error_page 500 502 504 /500.html; error_page 503 @503; # Return a 503 error if the maintenance page exists. if (-f /home/admin/apps/fablab_staging/shared/system/maintenance.html) { return 503; } location @503 { # Serve static assets if found. if (-f $request_filename) { break; } # Set root to the shared directory. root /home/admin/apps/fablab_staging/shared; rewrite ^(.*)$ /system/maintenance.html break; } }