From 81d822db18efe223e1cd161e12ead72607ac00f4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Th=C3=A9ophile=20Bastian?= Date: Mon, 30 Oct 2017 17:58:39 +0100 Subject: [PATCH] Add nginx configuration file Includes preparation.pdf rule --- nginx/nginx.conf | 47 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 nginx/nginx.conf diff --git a/nginx/nginx.conf b/nginx/nginx.conf new file mode 100644 index 0000000..4839abb --- /dev/null +++ b/nginx/nginx.conf @@ -0,0 +1,47 @@ +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; +} +