Some config files for the NginX web server & reverse proxy server
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

57 lines
1.9 KiB

  1. # Example configuration for another subdomain
  2. # Redirect http traffic to https
  3. server {
  4. listen 80;
  5. server_name YOURSUBDOMAIN.YOURSITEDOMAIN.com;
  6. return 301 https://$host$request_uri;
  7. }
  8. # Main https server block
  9. server {
  10. listen 443;
  11. server_name YOURSUBDOMAIN.YOURSITEDOMAIN.com;
  12. # SSL configuration
  13. ssl_certificate /etc/letsencrypt/live/YOURSUBDOMAIN.YOURSITEDOMAIN.com/fullchain.pem; # managed by Certbot
  14. ssl_certificate_key /etc/letsencrypt/live/YOURSUBDOMAIN.YOURSITEDOMAIN.com/privkey.pem; # managed by Certbot
  15. ssl on;
  16. ssl_session_cache builtin:1000 shared:SSL:10m;
  17. ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
  18. ssl_ciphers HIGH:!aNULL:!eNULL:!EXPORT:!CAMELLIA:!DES:!MD5:!PSK:!RC4;
  19. ssl_prefer_server_ciphers on;
  20. # Set the access log location
  21. access_log /var/log/nginx/YOURSUBDOMAIN.access.log;
  22. location / {
  23. # Set the proxy headers
  24. proxy_set_header Host $host;
  25. proxy_set_header X-Real-IP $remote_addr;
  26. proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  27. proxy_set_header X-Forwarded-Proto $scheme;
  28. # Configure which address the request is proxied to
  29. proxy_pass http://YOURSERVER:YOURPORT;
  30. proxy_read_timeout 90;
  31. proxy_redirect http://YOURSERVER:YOURPORT https://YOURSUBDOMAIN.YOURSITEDOMAIN.com;
  32. # Set the security headers
  33. add-header Permissions-Policy "interest-cohort=()"; # Don't allow Google FLoC
  34. add_header Strict-Transport-Security "max-age=31536000; includeSubDomains; preload"; #HSTS
  35. add_header X-Frame-Options DENY; #Prevents clickjacking
  36. add_header X-Content-Type-Options nosniff; #Prevents mime sniffing
  37. add_header X-XSS-Protection "1; mode=block"; #Prevents cross-site scripting attacks
  38. add_header Referrer-Policy "origin"; #Idk what this actually does";
  39. }
  40. }