283 lines
8.6 KiB
Nginx Configuration File
283 lines
8.6 KiB
Nginx Configuration File
user www-data;
|
|
worker_processes auto;
|
|
worker_rlimit_nofile 8192;
|
|
pid /run/nginx.pid;
|
|
|
|
events {
|
|
worker_connections 4096;
|
|
}
|
|
|
|
http {
|
|
include mime.types;
|
|
default_type application/octet-stream;
|
|
|
|
charset utf-8;
|
|
|
|
sendfile on;
|
|
tcp_nopush on;
|
|
tcp_nodelay on;
|
|
keepalive_timeout 65;
|
|
types_hash_max_size 4096;
|
|
server_tokens off;
|
|
|
|
client_max_body_size 1k;
|
|
client_body_buffer_size 1k;
|
|
client_header_buffer_size 1k;
|
|
large_client_header_buffers 4 4k;
|
|
http2_max_field_size 4k;
|
|
http2_max_header_size 16k;
|
|
http2_recv_buffer_size 128k;
|
|
|
|
client_body_timeout 30s;
|
|
client_header_timeout 30s;
|
|
send_timeout 30s;
|
|
http2_recv_timeout 30s;
|
|
|
|
http2_max_concurrent_streams 32;
|
|
limit_conn_zone $binary_remote_addr zone=addr:10m;
|
|
limit_conn addr 256;
|
|
|
|
ssl_protocols TLSv1.2 TLSv1.3;
|
|
ssl_ciphers ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES128-GCM-SHA256;
|
|
ssl_prefer_server_ciphers on;
|
|
|
|
ssl_certificate /etc/letsencrypt/live/grapheneos.org/fullchain.pem;
|
|
ssl_certificate_key /etc/letsencrypt/live/grapheneos.org/privkey.pem;
|
|
|
|
ssl_session_cache shared:SSL:10m;
|
|
ssl_session_timeout 1d;
|
|
ssl_session_tickets off;
|
|
ssl_buffer_size 4k;
|
|
|
|
ssl_trusted_certificate /etc/letsencrypt/live/grapheneos.org/chain.pem;
|
|
ssl_stapling on;
|
|
ssl_stapling_verify on;
|
|
# maintained by certbot-ocsp-fetcher
|
|
ssl_stapling_file /etc/nginx/ocsp-cache/grapheneos.org.der;
|
|
|
|
access_log /var/log/nginx/access.log combined buffer=64k flush=1m;
|
|
error_log /var/log/nginx/error.log;
|
|
|
|
gzip_proxied any;
|
|
gzip_vary on;
|
|
|
|
if_modified_since before;
|
|
|
|
server {
|
|
listen 80 backlog=4096;
|
|
listen [::]:80 backlog=4096;
|
|
server_name grapheneos.org www.grapheneos.org grapheneos.app www.grapheneos.app grapheneos.com www.grapheneos.com grapheneos.info www.grapheneos.info grapheneos.page www.grapheneos.page vanadium.app www.vanadium.app;
|
|
|
|
root /var/empty;
|
|
|
|
return 301 https://$host$request_uri;
|
|
}
|
|
|
|
server {
|
|
listen 443 ssl http2 backlog=4096;
|
|
listen [::]:443 ssl http2 backlog=4096;
|
|
server_name www.grapheneos.org grapheneos.app www.grapheneos.app grapheneos.com www.grapheneos.com grapheneos.info www.grapheneos.info grapheneos.page www.grapheneos.page;
|
|
|
|
root /var/empty;
|
|
|
|
include /etc/nginx/snippets/security-headers.conf;
|
|
|
|
return 301 https://grapheneos.org$request_uri;
|
|
}
|
|
|
|
server {
|
|
listen 443 ssl http2;
|
|
listen [::]:443 ssl http2;
|
|
server_name vanadium.app www.vanadium.app;
|
|
|
|
root /var/empty;
|
|
|
|
include /etc/nginx/snippets/security-headers.conf;
|
|
|
|
return 302 https://github.com/GrapheneOS/Vanadium;
|
|
}
|
|
|
|
server {
|
|
listen 443 ssl http2;
|
|
listen [::]:443 ssl http2;
|
|
server_name grapheneos.org;
|
|
|
|
root /var/www/html;
|
|
error_page 403 =404 /404.html;
|
|
error_page 404 /404.html;
|
|
|
|
include /etc/nginx/snippets/security-headers.conf;
|
|
gzip_static on;
|
|
|
|
if ($request_uri ~ ^/(.*)\.html$) {
|
|
return 301 /$1;
|
|
}
|
|
|
|
if ($request_uri ~ "//") {
|
|
return 301 $uri$is_args$args;
|
|
}
|
|
|
|
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-donation.png;
|
|
}
|
|
|
|
location = /bitcoin-address.png {
|
|
return 301 /bitcoin-donation.png;
|
|
}
|
|
|
|
# mangled backlinks to /install
|
|
location = /installMinimal {
|
|
return 301 /install;
|
|
}
|
|
|
|
location = /install {
|
|
return 301 /install/cli;
|
|
}
|
|
|
|
location = /web-install {
|
|
return 301 /install/web;
|
|
}
|
|
|
|
location = /LICENSE {
|
|
return 301 /LICENSE.txt;
|
|
}
|
|
|
|
location = /mstile-150x150.png {
|
|
return 301 /mstile/150x150.png;
|
|
}
|
|
|
|
location = /mstile-310x310.png {
|
|
return 301 /mstile/310x310.png;
|
|
}
|
|
|
|
location = /mstile-70x70.png {
|
|
return 301 /mstile/70x70.png;
|
|
}
|
|
|
|
location = /mstile-310x150.png {
|
|
return 301 /mstile/310x150.png;
|
|
}
|
|
|
|
location = /generate_204 {
|
|
return 301 /faq#default-connections;
|
|
}
|
|
|
|
location = /404 {
|
|
internal;
|
|
http2_push /grapheneos.css?29;
|
|
}
|
|
|
|
location = /404.html {
|
|
internal;
|
|
http2_push /grapheneos.css?29;
|
|
}
|
|
|
|
# broken link (now fixed) on https://noagendaphone.com/ with UTF-8 replacement character
|
|
location ~ "^/\xEF\xBF\xBC$" {
|
|
return 301 /;
|
|
}
|
|
|
|
location ~ "^(.*)/index$" {
|
|
return 301 $1/;
|
|
}
|
|
|
|
location ~ "\.(ico|webmanifest)$" {
|
|
include /etc/nginx/snippets/security-headers.conf;
|
|
add_header Cache-Control "public, max-age=604800";
|
|
}
|
|
|
|
location ~ "\.(css|js|svg)$" {
|
|
include /etc/nginx/snippets/security-headers.conf;
|
|
add_header Cache-Control "public, max-age=31536000";
|
|
}
|
|
|
|
location ~ "\.(png|woff2)$" {
|
|
include /etc/nginx/snippets/security-headers.conf;
|
|
add_header Cache-Control "public, max-age=31536000";
|
|
gzip_static off;
|
|
}
|
|
|
|
location ~ "\.(atom|json|pdf|txt|xml)$" {
|
|
include /etc/nginx/snippets/security-headers.conf;
|
|
add_header Cache-Control "public, max-age=1800";
|
|
}
|
|
|
|
# https://www.twipu.com/GrapheneOS doesn't handle links with fragments properly
|
|
location ~ "^/(.*)<a href=$" {
|
|
return 301 https://grapheneos.org/$1;
|
|
}
|
|
|
|
location ~ "\.(br|gz)$" {
|
|
internal;
|
|
}
|
|
|
|
location = /install/web {
|
|
include /etc/nginx/snippets/security-headers-base.conf;
|
|
add_header Content-Security-Policy "default-src 'none'; connect-src 'self' https://releases.grapheneos.org/; font-src 'self'; img-src 'self'; manifest-src 'self'; script-src 'self'; style-src 'self'; form-action 'none'; frame-ancestors 'none'; block-all-mixed-content; base-uri 'none'" always;
|
|
add_header Permissions-Policy "accelerometer=(), ambient-light-sensor=(), autoplay=(), battery=(), camera=(), display-capture=(), document-domain=(), encrypted-media=(), fullscreen=(), geolocation=(), gyroscope=(), magnetometer=(), microphone=(), midi=(), payment=(), picture-in-picture=(), publickey-credentials-get=(), screen-wake-lock=(), sync-xhr=(), xr-spatial-tracking=()" always;
|
|
# Feature-Policy is being replaced by Permissions-Policy
|
|
add_header Feature-Policy "accelerometer 'none'; ambient-light-sensor 'none'; autoplay 'none'; battery 'none'; camera 'none'; display-capture 'none'; document-domain 'none'; encrypted-media 'none'; fullscreen 'none'; geolocation 'none'; gyroscope 'none'; magnetometer 'none'; microphone 'none'; midi 'none'; payment 'none'; picture-in-picture 'none'; publickey-credentials-get 'none'; screen-wake-lock 'none'; sync-xhr 'none'; xr-spatial-tracking 'none'" always;
|
|
add_header Cache-Control "public, max-age=1800";
|
|
try_files $uri.html =404;
|
|
http2_push /grapheneos.css?29;
|
|
}
|
|
|
|
location / {
|
|
include /etc/nginx/snippets/security-headers.conf;
|
|
add_header Cache-Control "public, max-age=1800";
|
|
try_files $uri $uri.html $uri/ =404;
|
|
http2_push /grapheneos.css?29;
|
|
}
|
|
}
|
|
|
|
server {
|
|
listen 80;
|
|
listen [::]:80;
|
|
server_name mta-sts.grapheneos.org mta-sts.mail.grapheneos.org mta-sts.grapheneos.app mta-sts.grapheneos.com mta-sts.grapheneos.info mta-sts.grapheneos.page mta-sts.vanadium.app;
|
|
|
|
root /var/empty;
|
|
|
|
return 301 https://$host$request_uri;
|
|
}
|
|
|
|
server {
|
|
listen 443 ssl http2;
|
|
listen [::]:443 ssl http2;
|
|
server_name mta-sts.grapheneos.org mta-sts.mail.grapheneos.org mta-sts.grapheneos.app mta-sts.grapheneos.com mta-sts.grapheneos.info mta-sts.grapheneos.page mta-sts.vanadium.app;
|
|
|
|
root /var/www/mta-sts;
|
|
|
|
include /etc/nginx/snippets/security-headers.conf;
|
|
}
|
|
|
|
server {
|
|
listen 127.0.0.1:81;
|
|
listen [::1]:81;
|
|
|
|
location /nginx_status {
|
|
stub_status;
|
|
access_log off;
|
|
}
|
|
}
|
|
}
|