server { listen 80; listen [::]:80; server_name lemmy.datura.network; return 301 https://$server_name$request_uri; } server { listen 443 ssl; listen [::]:443 ssl http2; server_name lemmy.datura.network; ssl_certificate /root/.acme.sh/lemmy.datura.network/fullchain.cer; ssl_certificate_key /root/.acme.sh/lemmy.datura.network/lemmy.datura.network.key; ssl_dhparam /root/.acme.sh/dhparam.pem; ######## TOR CHANGES ######## listen 4443; listen [::]:4443; server_name lemmy.daturab6drmkhyeia4ch5gvfc2f3wgo6bhjrv3pz6n7kxmvoznlkq4yd.onion; add_header Onion-Location "http://lemmy.daturab6drmkhyeia4ch5gvfc2f3wgo6bhjrv3pz6n7kxmvoznlkq4yd.onion$request_uri" always; ######## TOR CHANGES ######## ssl_protocols TLSv1.2 TLSv1.3; ssl_prefer_server_ciphers on; 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:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA256'; ssl_session_timeout 10m; ssl_session_cache shared:SSL:10m; ssl_session_tickets on; ssl_stapling on; ssl_stapling_verify on; # Hide nginx version server_tokens off; # Upload limit, relevant for pictrs client_max_body_size 20M; # Enable compression for JS/CSS/HTML bundle, for improved client load times. # It might be nice to compress JSON, but leaving that out to protect against potential # compression+encryption information leak attacks like BREACH. gzip on; gzip_types text/css application/javascript image/svg+xml; gzip_vary on; # Various content security headers add_header Referrer-Policy "same-origin"; add_header X-Content-Type-Options "nosniff"; add_header X-Frame-Options "DENY"; add_header X-XSS-Protection "1; mode=block"; location / { proxy_pass http://localhost:1236; set $proxpass "http://127.0.0.1:1236"; if ($http_accept = "application/activity+json") { set $proxpass "http://127.0.0.1:1236"; } if ($http_accept = "application/ld+json; profile=\"https://www.w3.org/ns/activitystreams\"") { set $proxpass "http://127.0.0.1:1236"; } #proxy_pass $proxpass; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; proxy_set_header X-Real-IP $remote_addr; proxy_set_header Host $host; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; } }