2023-01-23 22:44:19 +00:00
|
|
|
server {
|
|
|
|
server_name example.tld;
|
|
|
|
|
|
|
|
listen 80;
|
|
|
|
listen [::]:80;
|
|
|
|
|
|
|
|
location / {
|
|
|
|
return 301 https://$server_name$request_uri;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
server {
|
|
|
|
server_name example.tld;
|
|
|
|
|
|
|
|
listen 443 ssl http2;
|
|
|
|
listen [::]:443 ssl http2;
|
|
|
|
|
|
|
|
ssl_certificate /etc/letsencrypt/live/example.tld/fullchain.pem;
|
|
|
|
ssl_certificate_key /etc/letsencrypt/live/example.tld/privkey.pem;
|
|
|
|
ssl_trusted_certificate /etc/letsencrypt/live/example.tld/chain.pem;
|
|
|
|
|
|
|
|
ssl_session_timeout 1d;
|
|
|
|
ssl_session_cache shared:MozSSL:10m; # about 40000 sessions
|
|
|
|
ssl_session_tickets off;
|
|
|
|
|
|
|
|
ssl_protocols TLSv1.2 TLSv1.3;
|
|
|
|
ssl_ciphers "ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA384:!aNULL:!eNULL:!EXPORT:!DES:!MD5:!PSK:!RC4";
|
|
|
|
ssl_prefer_server_ciphers off;
|
|
|
|
|
|
|
|
ssl_stapling on;
|
|
|
|
ssl_stapling_verify on;
|
|
|
|
|
|
|
|
add_header Strict-Transport-Security "max-age=63072000" always;
|
2023-02-22 15:18:19 +00:00
|
|
|
|
|
|
|
# CSP header can't be added in location block
|
2023-02-11 16:12:15 +00:00
|
|
|
add_header Content-Security-Policy "default-src 'none'; connect-src 'self'; img-src 'self' data:; media-src 'self'; script-src 'self' 'unsafe-inline'; style-src 'self' 'nonce-oauth-authorization'; frame-ancestors 'none'; base-uri 'self'; form-action 'self'";
|
2023-01-23 22:44:19 +00:00
|
|
|
add_header X-Content-Type-Options "nosniff";
|
|
|
|
|
2023-02-04 00:16:40 +00:00
|
|
|
client_max_body_size 10M;
|
|
|
|
|
2023-01-23 22:44:19 +00:00
|
|
|
location / {
|
|
|
|
# Frontend
|
|
|
|
root /usr/share/mitra/www;
|
|
|
|
try_files $uri /index.html;
|
|
|
|
}
|
|
|
|
|
|
|
|
location ~ ^/(actor|api|collections|contracts|feeds|media|nodeinfo|oauth|objects|users|.well-known) {
|
|
|
|
# Backend
|
|
|
|
proxy_pass http://127.0.0.1:8383;
|
|
|
|
proxy_set_header Host $http_host;
|
2023-02-22 14:53:05 +00:00
|
|
|
proxy_set_header X-Forwarded-Proto $scheme;
|
2023-01-23 22:44:19 +00:00
|
|
|
proxy_set_header X-Forwarded-For $remote_addr;
|
|
|
|
}
|
|
|
|
}
|