Skip to content

Instantly share code, notes, and snippets.

@eliyas5044
Created October 29, 2024 01:50
Show Gist options
  • Save eliyas5044/7249235475955fd9850441ddc9fbc7c4 to your computer and use it in GitHub Desktop.
Save eliyas5044/7249235475955fd9850441ddc9fbc7c4 to your computer and use it in GitHub Desktop.
Caddy server configuration for a Laravel application

Caddyfile

  • Update the caddyfile into /etc/caddy/Caddyfile
example.com {
	root * /var/www/html/public
	encode gzip
	reverse_proxy /socket/* http://0.0.0.0:8080

	php_fastcgi unix//run/php/php8.3-fpm.sock
	file_server
	header / {
		-Server
		Strict-Transport-Security "max-age=31536000; includeSubDomains; preload"
	}

	@notFound {
		file {
			try_files {path} {path}/ /index.php
		}
	}

	rewrite @notFound /index.php
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment