Assume your Laravel project is in /home/cheeze/my-app/
, make sure www-data
has access to ./storage
and ./bootstrap/cache/
with:
sudo chown -R www-data:www-data storage
sudo chown -R www-data:www-data bootstrap/cache
This is because Caddy needs write access to the logs inside these folders.
If you want to host this laravel app on https://laravel.example.com
,
# /etc/caddy/Caddyfile
laravel.example.com {
root * /home/cheeze/my-app/public # IMPORTANT! NOT /home/cheeze/my-app/
encode zstd gzip # enable Zstandard and Gzip compression
file_server
php_fastcgi unix//run/php/php8.1-fpm.sock # remember to install `php8.1-fpm`
}
- Restart Caddy after editing Caddyfile
- Remember to run
npm run build
andbootstrap/ssr/ssr.mjs
In Arch, make sure to add the caddy
user to http
group. www-data
is now http
.