irpg 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. ## irpg site config
  2. server {
  3. listen 80;
  4. listen [::]:80;
  5. listen 443 ssl;
  6. listen [::]:443 ssl;
  7. server_name irpg.demu.red;
  8. root /var/www/irpg;
  9. access_log /var/log/nginx/irpg_access.log;
  10. error_log /var/log/nginx/irpg_error.log;
  11. ## Disable all methods besides HEAD, GET and POST.
  12. if ($request_method !~ ^(GET|HEAD|POST)$ ) {
  13. return 444;
  14. }
  15. index idlerpg.html index.php index.html;
  16. ## Include certbot fix
  17. include /etc/nginx/snippets/nginx.well-known.conf;
  18. ## Include ssl
  19. include /etc/nginx/snippets/nginx.ssl.conf;
  20. ### Deny Stuffs ### {{{
  21. ## Protect specific TXT and config files
  22. location ~ /(\.|readme.html|readme.md|changelog.txt|changelog.md|contributing.txt|contributing.md|license.txt|license.md|legalnotice|privacy.txt|privacy.md|security.txt|security.md|sample-.*txt)
  23. {
  24. deny all;
  25. }
  26. ## Protect .git files
  27. location ~ /\.git/ {
  28. access_log off;
  29. log_not_found off;
  30. deny all;
  31. }
  32. ### End Deny Stuffs ### }}}
  33. location / {
  34. #try_files $uri $uri/ idlerpg.html =404;
  35. try_files $uri /idlerpg.html;
  36. location ~ ^(.+\.php)(.*)$ {
  37. fastcgi_split_path_info ^(.+\.php)(.*)$;
  38. try_files $uri =404;
  39. fastcgi_pass unix:/var/run/php/php7.4-fpm.sock;
  40. fastcgi_index index.php;
  41. ## https://stackoverflow.com/questions/28490391/how-to-properly-configure-alias-directive-in-nginx
  42. fastcgi_param SCRIPT_FILENAME $request_filename;
  43. include fastcgi_params;
  44. }
  45. location ~ /(php|js|css) {
  46. access_log off;
  47. }
  48. }
  49. ## Error Redirects
  50. error_page 403 /error.html;
  51. error_page 404 /error.html;
  52. error_page 405 /error.html;
  53. error_page 500 501 502 503 504 /error.html;
  54. location = /error.html {
  55. root /var/www/error;
  56. internal;
  57. }
  58. }