3 ## GargantText serveur configuration
4 ## Authors: team@gargantext.org
5 ## Licence CNRS/AGPLv3-MIT/CECILL-INRIA
7 # Fee free to improve it
8 # Thanks for sharing to all community
11 # Specific NGINX informations
13 # You should look at the following URL's in order to grasp a solid understanding
14 # of Nginx configuration files in order to fully unleash the power of Nginx.
15 # http://wiki.nginx.org/Pitfalls
16 # http://wiki.nginx.org/QuickStart
17 # http://wiki.nginx.org/Configuration
19 # Generally, you will want to move this file somewhere, and start with a clean
20 # file but keep this around for reference. Or just disable in sites-enabled.
22 # Please see /usr/share/doc/nginx-doc/examples/ for more detailed examples.
27 server_name doc.gargantext.org;
29 add_header Cache-Control "no-cache";
35 listen 443 ssl; # managed by Certbot
36 ssl_certificate /etc/letsencrypt/live/v4.gargantext.org/fullchain.pem; # managed by Certbot
37 ssl_certificate_key /etc/letsencrypt/live/v4.gargantext.org/privkey.pem; # managed by Certbot
38 include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
39 ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
43 # Comment this for maintenance only
46 #server_name v4.gargantext.org;
47 server_name maintenanceOnly.gargantext.org;
49 add_header Cache-Control "no-cache";
51 root /var/www/maintenance/;
55 listen 443 ssl; # managed by Certbot
56 ssl_certificate /etc/letsencrypt/live/v4.gargantext.org/fullchain.pem; # managed by Certbot
57 ssl_certificate_key /etc/letsencrypt/live/v4.gargantext.org/privkey.pem; # managed by Certbot
58 include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
59 ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
67 if ($host = v4.gargantext.org) {
68 return 301 https://$host$request_uri;
69 } # managed by Certbot
74 server_name v4.gargantext.org;
76 add_header Cache-Control "no-cache";
78 location '/.well-known/acme-challenge' {
79 root /var/www/gargantext;
82 # Always redirect to https
83 return 301 https://v4.gargantext.org$request_uri;
92 server_name v4.gargantext.org;
94 # Some options configurations:
95 # https://github.com/h5bp/server-configs-nginx/blob/master/h5bp/location/expires.conf
96 add_header Cache-Control "no-cache";
100 # listen 443 ssl default_server;
101 # listen [::]:443 ssl default_server;
104 ssl_certificate /etc/letsencrypt/live/v4.gargantext.org/fullchain.pem; # managed by Certbot
105 ssl_certificate_key /etc/letsencrypt/live/v4.gargantext.org/privkey.pem; # managed by Certbot
107 # Note: You should disable gzip for SSL traffic.
108 # See: https://bugs.debian.org/773332
110 # Read up on ssl_ciphers to ensure a secure configuration.
111 # See: https://bugs.debian.org/765782
113 # Self signed certs generated by the ssl-cert package
114 # Don't use them in a production server!
116 # include snippets/snakeoil.conf;
118 client_max_body_size 800M;
119 client_body_timeout 12;
120 client_header_timeout 12;
121 keepalive_timeout 15;
127 #add_header Access-Control-Allow-Origin $http_origin always;
128 # Add index.php to the list if you are using PHP
129 #index index.html index.htm index.nginx-debian.html;
131 # CORS config borrowed from: https://gist.github.com/pauloricardomg/7084524
132 # NP: not sure we need CORS yet
134 if ($http_origin ~* (^https?://(127.0.0.1|localhost|v4\.gargantext\.com))) {
138 # Cross-Origin Resource Sharing
139 if ($request_method = "OPTIONS") {
140 set $cors "${cors}o";
145 location '/.well-known/acme-challenge' {
146 alias /var/www/gargantext/.well-known/acme-challenge ;
151 # limit_except OPTIONS {
152 # auth_basic "Gargantext's Development Version";
153 # auth_basic_user_file /etc/nginx/haskell_gargantext.htpasswd;
156 proxy_set_header X-Real-IP $remote_addr;
157 proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
158 proxy_set_header X-Forwarded-Proto $scheme;
159 proxy_set_header Host $http_host;
161 proxy_pass http://127.0.0.1:8008;
167 # https://stackoverflow.com/a/48708812
168 # limit_except OPTIONS {
169 # auth_basic "Gargantext's Development Version";
170 # auth_basic_user_file /etc/nginx/haskell_gargantext.htpasswd;
173 proxy_set_header X-Real-IP $remote_addr;
174 proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
175 proxy_set_header X-Forwarded-Proto $scheme;
176 proxy_set_header Host $http_host;
178 proxy_pass http://127.0.0.1:8008;
184 access_log /var/log/nginx/access.log;
185 error_log /var/log/nginx/error.log;
194 if ($host = doc.gargantext.org) {
195 return 301 https://$host$request_uri;
196 } # managed by Certbot
200 server_name doc.gargantext.org;
201 return 404; # managed by Certbot