Caddyfile 1.0 KB

12345678910111213141516171819202122232425262728293031
  1. # To use this file simply install caddy and run the command below from the root of your Grav site
  2. # Once running it will redirect http://localhost to https://localhost (new default for Caddy2)
  3. # More infromation here: https://caddyserver.com/docs/
  4. #
  5. # $ caddy run --config webserver-configs/Caddyfile
  6. localhost
  7. encode gzip
  8. root * .
  9. file_server
  10. php_fastcgi 127.0.0.1:9000
  11. # Begin - Security
  12. # deny all direct access for these folders
  13. rewrite /(\.git|cache|bin|logs|backups|tests)/.* /403
  14. # deny running scripts inside core system folders
  15. rewrite /(system|vendor)/.*\.(txt|xml|md|html|yaml|yml|php|pl|py|cgi|twig|sh|bat)$ /403
  16. # deny running scripts inside user folder
  17. rewrite /user/.*\.(txt|md|yaml|yml|php|pl|py|cgi|twig|sh|bat)$ /403
  18. # deny access to specific files in the root folder
  19. rewrite /(LICENSE\.txt|composer\.lock|composer\.json|nginx\.conf|web\.config|htaccess\.txt|\.htaccess) /403
  20. respond /403 403
  21. ## End - Security
  22. # global rewrite should come last.
  23. try_files {path} {path}/ /index.php?_url={uri}&{query}