up 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. ## YOURLS site config
  2. server {
  3. listen 80;
  4. listen [::]:80;
  5. listen 443 ssl;
  6. listen [::]:443 ssl;
  7. server_name up.demu.red;
  8. root /var/www/up;
  9. access_log /var/log/nginx/up_access.log;
  10. error_log /var/log/nginx/up_error.log;
  11. ## Disable all methods besides HEAD, GET and POST.
  12. if ($request_method !~ ^(GET|HEAD|POST)$ ) {
  13. return 444;
  14. }
  15. index index.php index.html /_h5ai/public/index.php;
  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. location ~ ^(.+\.php)(.*)$ {
  35. fastcgi_split_path_info ^(.+\.php)(.*)$;
  36. try_files $uri =404;
  37. fastcgi_pass unix:/var/run/php/php7.4-fpm.sock;
  38. fastcgi_index index.php;
  39. ## https://stackoverflow.com/questions/28490391/how-to-properly-configure-alias-directive-in-nginx
  40. fastcgi_param SCRIPT_FILENAME $request_filename;
  41. include fastcgi_params;
  42. }
  43. location ~ /_h5ai {
  44. access_log off;
  45. }
  46. }
  47. ## Using h5ai instead https://larsjung.de/h5ai/
  48. ## Enable nginx dir index
  49. #location / {
  50. #autoindex on;
  51. #}
  52. ## Error Redirects
  53. # Done on purpose, as the main page is all in one.
  54. error_page 403 /index.html;
  55. error_page 404 /index.html;
  56. error_page 405 /index.html;
  57. error_page 500 501 502 503 504 /index.html;
  58. }