New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fastcgi.index works only with http.root #1778
Comments
Hi @casipw Thanks for the detailed issue. I can recreate this issue. The code seems to be correctly assigning the root but it is not matching the index file as you have stated, however I'm not sure if we want this to happen as the docs suggest that in some instances the fastcgi server will be running on another server. Perhaps @mholt could provide some clarity on what should happen in this situation, so either the code can be fixed or the documentation updated. In the meantime I think you can do what you want by structuring your caddyfile in a differnt way. If you explain what it is specifically you are trying to isolate we can make suggestions. |
I'm heading out the door but I'll ping @abiosoft for his thoughts on it too! |
@tobya I'm putting caddy and some services (one of it being a php-fpm instance) into Firejails. Caddy and each service have their own chroot-jail (like /srv/caddy, /srv/sub). I saw no need for a If I understand the code correctly, caddy tries to match an index file using |
After sleeping a night to think about it, things seem clearer to me.
I see three possible solutions here:
|
This is a bit tricky, the root fileserver needs to be aware there are other places to look for files. |
Is it possible to define what fastcgi.root is really for then? |
So it isn't possible to have different fastcgi root? I tried to "proxy" from https://github.com/lucaslorentz/caddy-docker-proxy via fastcgi to php backend. So there is no http.root, just fastcgi.root |
Caddy v2's redesigned middleware architecture solves this problem; URL rewriting including matching index files can be done outside of the reverse proxy (which is the module which serves fastcgi now). Since it's solved in v2 I'm going to close this. |
1. What version of Caddy are you using (
caddy -version
)?Caddy 0.10.4
2. What are you trying to do?
Running caddy with php-fpm. I'm going to isolate some services, so there is no shared caddy root.
3. What is your entire Caddyfile?
4. How did you run Caddy (give the full command and describe the execution environment)?
Via systemd. I'm going to put it into a jail, so don't worry about the root user and group (and don't try this at home). Here is my caddy.service:
5. Please paste any relevant HTTP request(s) here.
6. What did you expect to see?
7. What did you see instead (give full error messages and/or log)?
8. How can someone who is starting from scratch reproduce the bug as minimally as possible?
Apparently caddy doesn't find the index.php file.
I can solve the problem by moving the root directive to the server block:
It seems that caddy uses http.root instead of fastcgi.root to look for the fastcgi.index file. I'm not sure if this behaviour is intended. If it is, I suggest mentioning it in the docs.
The text was updated successfully, but these errors were encountered: