Source code for my website.
Ви не можете вибрати більше 25 тем Теми мають розпочинатися з літери або цифри, можуть містити дефіси (-) і не повинні перевищувати 35 символів.
 
 
 
 
 

70 рядки
1.8 KiB

  1. upstream node {
  2. server localhost:3000; # Host and Port of the Node.js application
  3. }
  4. server {
  5. listen 443 ssl http2;
  6. listen [::]:443 ssl http2;
  7. server_name example.com; # Change this with your own domain
  8. gzip on;
  9. ssl_certificate /path/to/cert.pem;
  10. ssl_certificate_key /path/to/private/key.pem;
  11. ssl_stapling on;
  12. ssl_stapling_verify on;
  13. ssl_trusted_certificate /path/to/fullchain.pem;
  14. ssl_session_timeout 5m;
  15. # Security headers
  16. add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always;
  17. add_header X-Frame-Options DENY always;
  18. add_header X-Content-Type-Options nosniff always;
  19. add_header Content-Security-Policy "default-src 'self';";
  20. add_header Referrer-Policy "no-referrer";
  21. add_header Permissions-Policy "accelerometer=(), camera=(), geolocation=(), gyroscope=(), magnetometer=(), microphone=(), payment=(), usb=()";
  22. root /var/www/express-starter;
  23. location /static/ {
  24. }
  25. location / {
  26. proxy_pass http://node;
  27. proxy_set_header X-Real-IP $remote_addr;
  28. proxy_set_header Host $host;
  29. proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  30. proxy_http_version 1.1;
  31. proxy_set_header Upgrade $http_upgrade;
  32. proxy_set_header Connection "upgrade";
  33. proxy_redirect off;
  34. }
  35. }
  36. server {
  37. if ($host = www.example.com) {
  38. rewrite ^/(.*) https://example.com/$1 permanent;
  39. }
  40. listen 443;
  41. listen [::]:443;
  42. server_name www.example.com;
  43. return 404;
  44. }
  45. server {
  46. if ($host = example.com) {
  47. return 301 https://$host$request_uri;
  48. }
  49. if ($host = www.example.com) {
  50. rewrite ^/(.*) https://example.com/$1 permanent;
  51. }
  52. listen 80;
  53. listen [::]:80;
  54. server_name www.example.com example.com;
  55. return 404;
  56. }