Here’s how you can run Laravel in a subfolder with Traefik. Let’s consider this scenario:
- Traefik is already installed with entry points
http
and https
.
- Laravel will be installed in the
/app
subfolder.
- Traefik and Laravel will use an external network called
traefik
.
Set the subfolder in APP_URL
.
Ensure that all proxies are allowed to let Laravel generate HTTPS URLs.
Always use URL helpers like url()
, route()
, etc., to generate full URLs, including the subfolder path.
That’s it! Now you can run your compose file with docker compose up -d
and access your Laravel application via the subfolder.