yourls 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. ## YOURLS site config
  2. server {
  3. listen 80;
  4. listen [::]:80;
  5. listen 443 ssl;
  6. listen [::]:443 ssl;
  7. server_name ln.demu.red;
  8. root /var/www/YOURLS;
  9. access_log /var/log/nginx/yourls_access.log;
  10. error_log /var/log/nginx/yourls_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;
  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/ /yourls-loader.php?$query_string;
  35. expires 14d;
  36. add_header Cache-Control 'public';
  37. #location ~ ^/add/(.*)$ {
  38. #alias /var/www/YOURLS/admin/$1;
  39. #try_files $uri /api/index.php;
  40. #}
  41. location ~ /(js|css|images) {
  42. access_log off;
  43. }
  44. }
  45. location ~ \.php$ {
  46. fastcgi_split_path_info ^(.+\.php)(/.+)$;
  47. fastcgi_pass unix:/var/run/php/php7.4-fpm.sock;
  48. fastcgi_index index.php;
  49. include fastcgi_params;
  50. fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
  51. fastcgi_intercept_errors off;
  52. fastcgi_buffer_size 16k;
  53. fastcgi_buffers 4 16k;
  54. }
  55. ## Error Redirects
  56. # Done on purpose, as the main page is all in one.
  57. error_page 403 /index.html;
  58. error_page 404 /index.html;
  59. error_page 405 /index.html;
  60. error_page 500 501 502 503 504 /index.html;
  61. }