diff options
| author | Daniel Micay <danielmicay@gmail.com> | 2020-04-01 03:12:09 -0400 |
|---|---|---|
| committer | Daniel Micay <danielmicay@gmail.com> | 2020-04-01 03:12:09 -0400 |
| commit | 9c1ebdd0d805b17202a3121fe7df247c9e1f43fe (patch) | |
| tree | 269fccdb93479d624cd9077a7fa17c0a505bcb76 /nginx/server.conf | |
| parent | ffdbd667142910f472a79b934fc91f1631f70bd1 (diff) | |
add nginx configuration
Diffstat (limited to 'nginx/server.conf')
| -rw-r--r-- | nginx/server.conf | 121 |
1 files changed, 121 insertions, 0 deletions
diff --git a/nginx/server.conf b/nginx/server.conf new file mode 100644 index 00000000..fee40bbc --- /dev/null +++ b/nginx/server.conf @@ -0,0 +1,121 @@ +server { + listen 80; + listen [::]:80; + + server_name connectivitycheck.grapheneos.org www.grapheneos.org grapheneos.org; + + root /var/empty; + + return 301 https://grapheneos.org$request_uri; +} + +server { + listen 443 ssl http2; + listen [::]:443 ssl http2; + + server_name connectivitycheck.grapheneos.org www.grapheneos.org grapheneos.org; + + root /var/www/html; + + ssl_certificate /etc/letsencrypt/live/grapheneos.org/fullchain.pem; + ssl_certificate_key /etc/letsencrypt/live/grapheneos.org/privkey.pem; + include /etc/letsencrypt/options-ssl-nginx.conf; + ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; + + ssl_trusted_certificate /etc/letsencrypt/live/grapheneos.org/chain.pem; + ssl_stapling on; + ssl_stapling_verify on; + + if ($host != "grapheneos.org") { + return 301 https://grapheneos.org$request_uri; + } + + if ($request_uri ~ ^/(.*)\.html$) { + return 301 /$1; + } + + if ($request_uri ~ ^(.*)/index$) { + return 301 $1/; + } + + location = /security.txt { + return 301 /.well-known/security.txt; + } + + location = /graphene.png { + return 301 /logo.png; + } + + location = /pdfviewer_privacy_policy { + return 301 /pdfviewer-privacy-policy; + } + + location = /safari_pinned_tab_icon.svg { + return 301 /mask-icon.svg; + } + + location = /safari-pinned-tab-icon.svg { + return 301 /mask-icon.svg; + } + + location = /bitcoin_address.png { + return 301 /bitcoin-address.png; + } + + location = /generate_204 { + return 204; + } + + location = /LICENSE { + default_type text/plain; + } + + location ~ "\.(html|txt|xml)$" { + include /etc/nginx/snippets/security-headers.conf; + add_header Cache-Control "public, max-age=1800"; + } + + location ~ "\.(ico|webmanifest)$" { + include /etc/nginx/snippets/security-headers.conf; + add_header Cache-Control "public, max-age=604800"; + } + + location ~ "\.(css|js|png|svg|woff2)$" { + include /etc/nginx/snippets/security-headers.conf; + add_header Cache-Control "public, max-age=31536000"; + } + + try_files $uri $uri.html $uri/ =404; + include /etc/nginx/snippets/security-headers.conf; +} + +server { + listen 80; + listen [::]:80; + + server_name mta-sts.grapheneos.org; + + root /var/empty; + + return 301 https://mta-sts.grapheneos.org$request_uri; +} + +server { + listen 443 ssl http2; + listen [::]:443 ssl http2; + + server_name mta-sts.grapheneos.org; + + root /var/www/mta-sts; + + ssl_certificate /etc/letsencrypt/live/grapheneos.org/fullchain.pem; + ssl_certificate_key /etc/letsencrypt/live/grapheneos.org/privkey.pem; + include /etc/letsencrypt/options-ssl-nginx.conf; + ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; + + ssl_trusted_certificate /etc/letsencrypt/live/grapheneos.org/chain.pem; + ssl_stapling on; + ssl_stapling_verify on; + + include /etc/nginx/snippets/security-headers.conf; +} |
