1. Caddy version (caddy version
):
2
2. How I run Caddy:
I’m not sure what you mean by this. I have caddy v2 installed on Alma Linux VPS. I also have php 7.4 (including php-fpm and php-cgi) installed. I started caddy using
systemctl enable --now caddy
after setting up the Caddyfile and copying my php file into the docroot.
a. System environment:
Alma Linux
b. Command:
systemctl start caddy
c. Service/unit/compose file:
nope
N/A
d. My complete Caddyfile or JSON config:
www.arc2services.co.uk:80
root * /var/www/html
php_fastcgi /info/* localhost:9000
file_server
log {
output file /var/log/caddy/access.log
}
3. The problem I’m having:
If I put an index.html
file into /var/www/html
, Caddy will serve that.
However, it won’t serve index.php
; neither in that folder, nor in any subfolder.
4. Error messages and/or full log output:
{"level":"error","ts":1643069928.889307,"logger":"http.log.access.log0","msg":"handled request","request":{"remote_addr":"197.94.92.56:63238","proto":"HTTP/1.1","method":"GET","host":"www.arc2services.co.uk","uri":"/info","headers":{"Upgrade-Insecure-Requests":["1"],"Accept":["text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"],"User-Agent":["Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/15.1 Safari/605.1.15"],"Accept-Language":["en-GB,en;q=0.9"],"Accept-Encoding":["gzip, deflate"],"Connection":["keep-alive"]}},"common_log":"197.94.92.56 - - [25/Jan/2022:00:18:48 +0000] \"GET /info HTTP/1.1\" 404 0","user_id":"","duration":0.000124706,"size":0,"status":404,"resp_headers":{"Server":["Caddy"]}}
Here is an example of the request:
Summary
URL: http://www.arc2services.co.uk/
Status: 404 Not Found
Source: Network
Address: 77.68.122.128:80
Request
GET / HTTP/1.1
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Upgrade-Insecure-Requests: 1
Host: www.arc2services.co.uk
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/15.1 Safari/605.1.15
Accept-Language: en-GB,en;q=0.9
Accept-Encoding: gzip, deflate
Connection: keep-alive
Response
HTTP/1.1 404 Not Found
Date: Tue, 25 Jan 2022 00:37:48 GMT
Content-Length: 0
Server: Caddy
Here’s another similar one:
Summary
URL: http://www.arc2services.co.uk/info/
Status: 502 Bad Gateway
Source: Network
Address: 77.68.122.128:80
Request
GET /info/ HTTP/1.1
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Upgrade-Insecure-Requests: 1
Host: www.arc2services.co.uk
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/15.1 Safari/605.1.15
Accept-Language: en-GB,en;q=0.9
Accept-Encoding: gzip, deflate
Connection: keep-alive
Response
HTTP/1.1 502 Bad Gateway
Date: Tue, 25 Jan 2022 00:38:27 GMT
Content-Length: 0
Server: Caddy
5. What I already tried:
I tried the config shown. I also tried putting the index.php
file in the /var/www/html
folder with this config:
www.arc2services.co.uk:80
root * /var/www/html
php_fastcgi localhost:9000
file_server
log {
output file /var/log/caddy/access.log
}
I also tried it with php:9000
and 127.0.0.1:9000
instead of `localhost:9000. Why 9000 btw? How does that correlate with PHP?