simple-phpfpm-ssl.nginxconf 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. # https://www.howtoforge.com/tutorial/install-letsencrypt-and-secure-nginx-in-debian-9/
  2. server {
  3. listen 80;
  4. listen [::]:80;
  5. server_name DOMAIN.LTD;
  6. return 301 https://$server_name$request_uri;
  7. }
  8. server {
  9. listen 443 ssl;
  10. listen [::]:443 ssl;
  11. server_name DOMAIN.LTD;
  12. root /var/www/DOMAIN.LTD/public_html;
  13. index index.html index.php;
  14. charset utf-8;
  15. location / {
  16. try_files $uri $uri/ /index.php?$query_string;
  17. }
  18. location = /favicon.ico { access_log off; log_not_found off; }
  19. location = /robots.txt { access_log off; log_not_found off; }
  20. access_log on;
  21. error_log /var/www/DOMAIN.LTD/log/error.log;
  22. sendfile off;
  23. client_max_body_size 100m;
  24. #SSL Certificates
  25. ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
  26. ssl_certificate "/etc/letsencrypt/live/DOMAIN.LTD/fullchain.pem";
  27. ssl_certificate_key "/etc/letsencrypt/live/DOMAIN.LTD/privkey.pem";
  28. ssl_dhparam /etc/nginx/ssl/certs/DOMAIN.LTD/dhparam.pem;
  29. ssl_session_cache shared:SSL:1m;
  30. ssl_session_timeout 10m;
  31. ssl_ciphers HIGH:!aNULL:!MD5;
  32. #ssl_ciphers EECDH+CHACHA20:EECDH+AES128:RSA+AES128:EECDH+AES256:RSA+AES256:EECDH+3DES:RSA+3DES:!MD5;
  33. ssl_prefer_server_ciphers on;
  34. add_header Strict-Transport-Security "max-age=31536000;
  35. #includeSubDomains" always;
  36. location ~ \.php$ {
  37. fastcgi_split_path_info ^(.+\.php)(/.+)$;
  38. fastcgi_pass unix:/run/php/php7.4-fpm.sock;
  39. fastcgi_index index.php;
  40. include fastcgi_params;
  41. fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
  42. fastcgi_intercept_errors off;
  43. fastcgi_buffer_size 16k;
  44. fastcgi_buffers 4 16k;
  45. }
  46. location ~ /\.ht {
  47. deny all;
  48. }
  49. # website should not be displayed inside a <frame>, an <iframe> or an <object>
  50. add_header X-Frame-Options SAMEORIGIN;
  51. }