upstream bocal { server unix:/srv/bocal.cof.ens.fr/bocal.sock; } server { listen 443 ssl http2; listen [::]:443 ssl http2; include include/ssl_keys; server_name bocal.cof.ens.fr; access_log /var/log/nginx/bocal.cof.ens.fr.log; root /srv/bocal.cof.ens.fr/site/public; # Static files location ~ ^/static/ { include include/static; } location ~ ^/media/ { include include/static; } location ~ ^/bocal_www/ { include include/static; } # Direct access to preparation.pdf location ~ ^/preparation\.pdf { # No cache control - this will change quite often root /srv/bocal.cof.ens.fr/site/public/bocal_www/; } # Django app location ~ ^/ { include include/proxy_params; proxy_pass http://bocal; } } server { listen 80; listen [::]:80; server_name bocal.cof.ens.fr; access_log /var/log/nginx/bocal.cof.ens.fr.log; return 302 https://bocal.cof.ens.fr$request_uri; }