Root symlink folder updates and caddy reload not working

1. Caddy version (caddy version): v2.2.0

2. How I run Caddy:

caddy start

a. System environment:

Linux 4.15.0-106-generic x86_64

b. Command:

caddy reload

d. My complete Caddyfile or JSON config:

    on_demand_tls {
} {
	@cachedFiles {
	    path *.jpg *.jpeg *.png *.gif *.ico *.svg *.webp

	# root * /var/www/
	root * /var/www/

	header {
		Access-Control-Allow-Origin *
		Access-Control-Allow-Methods "GET, POST, PUT, PATCH, OPTIONS"
		Strict-Transport-Security max-age=31536000
		Referrer-Policy "no-referrer, strict-origin-when-cross-origin, no-referrer-when-downgrade"
		X-Content-Type-Options nosniff
		Access-Control-Allow-Headers "Origin, Access-Control-Allow-Headers, Access-Control-Allow-Origin, Accept, Content-Type, X-Auth-Token, X-Requested-With"

		CustomDomainHost {host}
		FWServe main
		X-Real-IP {remote}
		X-Forwarded-For {remote}
		X-Self-Sub false
		Server Avoca

	header @cachedFiles Cache-Control "public, max-age=31536002"

	log {
		output file /var/log/caddy/access2.log
		format console
		level error

	tls {

	encode gzip

    php_fastcgi unix//run/php/php-fpm.sock


3. The problem I’m having:

I’m using Envoyer to deploy my laravel app. (Introduction | Envoyer)

Envoyer creates and release folder and after done building will create a new symlink at this folder “var/www/”.

I reload caddy caddy reload and shows success. My problem has been after the symlink is swapped out caddy doesn’t seem to actually reload.

I have been using the non symlink folder path of the release as you can see in my caddyfile above. I know that caddy isn’t reload bc after i run a build locally I have several new js/css files after webpack runs and after a reload my app breaks bc it is looking for the old css/js. (ex. before push the app.js version as app.asd205449.js and the new app.js version is app.hpflrkt9.js.

4. Error messages and/or full log output:

5. What I already tried:

6. Links to relevant resources:

Caddy only reloads if the configuration actually changed. Otherwise, there’s no reason to reload.

So, Caddy doesn’t work with symlinks as roots then?
Even after a caddy reload command?


I think you need the resolve_root_symlink option of php_fastcgi which unfortunately isn’t documented on the site right now - but the change is made in the website source, it’ll be up next time the docs are pushed (probably around the time v2.3 is released).

php_fastcgi unix//run/php/php-fpm.sock {

Give that a shot and see if it works any better for you.


I think that worked. No need to run caddy reload!

1 Like

This topic was automatically closed after 30 days. New replies are no longer allowed.