1. Caddy version (caddy version
):
2.4.3
2. How I run Caddy:
Installed via PPA and it runs automatically via systemd or manually from caddy start
a. System environment:
Ubuntu 20.04
b. Command:
caddy start
c. Service/unit/compose file:
Paste full file contents here.
Make sure backticks stay on their own lines,
and the post looks nice in the preview pane.
d. My complete Caddyfile or JSON config:
https://thedeveloper.club {
tls email@gmail.com
encode zstd gzip
root * /var/www/
php_fastcgi localhost:9000
# Refer to the Caddy docs for more information:
# https://caddyserver.com/docs/caddyfile
file_server
try_files * /public/index.php
@cachedFiles {
path *.ico *.css *.js *.gif *.jpg *.jpeg *.png *.svg *.woff
}
header @cachedFiles Cache-Control max-age=5184000
3. The problem I’m having:
This is based on the question ask at How to assume index.php without sbowing it in the url which worked great, but this would be the follow up:
- When someone visits the site they do not see the index.php in the URL, which is good, but this same index.php is part of Laravel, so when it goes to another folder, the resource urls break. The reason behind this is that they are trying to look for the resource inside /public but they are getting / instead. So for example, the URL the resources get would be this:
https://site.com/plugins/bootstrap/dist/css/bootstrap.min.css
Which visually is what we want, but the ACTUAL resource is in
https://site.com/public/plugins/bootstrap/dist/css/bootstrap.min.css
Dont know if this makes sense, since it was a bit difficult for me to explain the logic here.
We want to show the resource as this if possible: https://site.com/plugins/bootstrap/dist/css/bootstrap.min.css
While pulling it correctly from https://site.com/public/plugins/bootstrap/dist/css/bootstrap.min.css
which has appended as a prefix the folder /public
Any idea, guidelines?