upstream unicorn { server unix:/tmp/unicorn.fablab.sock fail_timeout=0; } server { listen 80; server_name fablab.lacasemate.fr fablab.ccsti-grenoble.org; rewrite ^ https://fablab.lacasemate.fr$request_uri? permanent; } server { listen 443 ssl; server_name fablab.lacasemate.fr; root /home/sleede/apps/fablab/current/public; ssl on; ssl_certificate /etc/nginx/ssl/certificate.fablab.lacasemate.fr.crt; ssl_certificate_key /etc/nginx/ssl/fablab.lacasemate.fr.deprotected.key; #location / { # auth_basic "Restricted"; # auth_basic_user_file /home/sleede/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 @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; } 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/sleede/apps/fablab/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/sleede/apps/fablab/shared; rewrite ^(.*)$ /system/maintenance.html break; } }