3 # You should look at the following URL's in order to grasp a solid understanding
4 # of Nginx configuration files in order to fully unleash the power of Nginx.
5 # http://wiki.nginx.org/Pitfalls
6 # http://wiki.nginx.org/QuickStart
7 # http://wiki.nginx.org/Configuration
9 # Generally, you will want to move this file somewhere, and start with a clean
10 # file but keep this around for reference. Or just disable in sites-enabled.
12 # Please see /usr/share/doc/nginx-doc/examples/ for more detailed examples.
17 if ($host = dev.gargantext.org) {
18 return 301 https://$host$request_uri;
19 } # managed by Certbot
24 server_name dev.gargantext.org;
26 add_header Cache-Control "no-cache";
28 location '/.well-known/acme-challenge' {
29 root /var/www/gargantext;
32 # Always redirect to https
33 return 301 https://dev.gargantext.org$request_uri;
42 server_name dev.gargantext.org;
44 # Some options configurations:
45 # https://github.com/h5bp/server-configs-nginx/blob/master/h5bp/location/expires.conf
46 add_header Cache-Control "no-cache";
50 # listen 443 ssl default_server;
51 # listen [::]:443 ssl default_server;
54 ssl_certificate /etc/letsencrypt/live/dev.gargantext.org/fullchain.pem; # managed by Certbot
55 ssl_certificate_key /etc/letsencrypt/live/dev.gargantext.org/privkey.pem; # managed by Certbot
57 # Note: You should disable gzip for SSL traffic.
58 # See: https://bugs.debian.org/773332
60 # Read up on ssl_ciphers to ensure a secure configuration.
61 # See: https://bugs.debian.org/765782
63 # Self signed certs generated by the ssl-cert package
64 # Don't use them in a production server!
66 # include snippets/snakeoil.conf;
68 client_max_body_size 800M;
69 client_body_timeout 12;
70 client_header_timeout 12;
77 #add_header Access-Control-Allow-Origin $http_origin always;
78 # Add index.php to the list if you are using PHP
79 #index index.html index.htm index.nginx-debian.html;
81 # CORS config borrowed from: https://gist.github.com/pauloricardomg/7084524
82 # NP: not sure we need CORS yet
84 if ($http_origin ~* (^https?://(127.0.0.1|localhost|dev\.gargantext\.com))) {
88 # Cross-Origin Resource Sharing
89 if ($request_method = "OPTIONS") {
95 location '/.well-known/acme-challenge' {
96 alias /var/www/gargantext/.well-known/acme-challenge ;
101 # limit_except OPTIONS {
102 # auth_basic "Gargantext's Development Version";
103 # auth_basic_user_file /etc/nginx/haskell_gargantext.htpasswd;
106 proxy_set_header X-Real-IP $remote_addr;
107 proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
108 proxy_set_header X-Forwarded-Proto $scheme;
109 proxy_set_header Host $http_host;
111 proxy_pass http://127.0.0.1:8008;
117 # https://stackoverflow.com/a/48708812
118 limit_except OPTIONS {
119 auth_basic "Gargantext's Development Version";
120 auth_basic_user_file /etc/nginx/haskell_gargantext.htpasswd;
123 proxy_set_header X-Real-IP $remote_addr;
124 proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
125 proxy_set_header X-Forwarded-Proto $scheme;
126 proxy_set_header Host $http_host;
128 proxy_pass http://127.0.0.1:8008;
134 access_log /var/log/nginx/access.log;
135 error_log /var/log/nginx/error.log;