1. Caddy version (caddy version
): v2.4.6
2. How I run Caddy:
a. System environment:
Ububtu 21.10
b. Command:
caddy run --config /etc/caddy/Caddyfile
c. Service/unit/compose file:
d. My complete Caddyfile or JSON config:
{
debug
order cgi last
}
eternalStudent.xyz {
root * /var/www/html/eternalStudent.xyz
file_server
cgi /hello /usr/local/cgi-bin/hello
}
3. The problem I’m having:
I’m very new to this, and I wanted to test a simple cgi, but I can’t make it work.
The cgi module is installed, and I placed a simple bash file in /usr/local/cgi-bin that I named hello, following the guide here: cgi package - github.com/aksdb/caddy-cgi - pkg.go.dev, but all I get is HTTP ERROR 404
4. Error messages and/or full log output:
2022/03/25 16:19:53.730 INFO using provided configuration {“config_file”: “/etc/caddy/Caddyfile”, “config_adapter”: “”}
2022/03/25 16:19:53.734 INFO admin admin endpoint started {“address”: “tcp/localhost:2019”, “enforce_origin”: false, “origins”: [“127.0.0.1:2019”, “localhost:2019”, “[::1]:2019”]}
2022/03/25 16:19:53.734 INFO http server is listening only on the HTTPS port but has no TLS connection policies; adding one to enable TLS {“server_name”: “srv0”, “https_port”: 443}
2022/03/25 16:19:53.735 INFO http enabling automatic HTTP->HTTPS redirects {“server_name”: “srv0”}
2022/03/25 16:19:53.735 DEBUG http starting server loop {“address”: “[::]:443”, “http3”: false, “tls”: true}
2022/03/25 16:19:53.735 DEBUG http starting server loop {“address”: “[::]:80”, “http3”: false, “tls”: false}
2022/03/25 16:19:53.735 INFO http enabling automatic TLS certificate management {“domains”: [“eternalstudent.xyz”]}
2022/03/25 16:19:53.736 DEBUG tls loading managed certificate {“domain”: “eternalstudent.xyz”, “expiration”: “2022/06/23 14:57:50.000”, “issuer_key”: “acme-v02.api.letsencrypt.org-directory”, “storage”: “FileStorage:/root/.local/share/caddy”}
2022/03/25 16:19:53.736 DEBUG tls.cache added certificate to cache {“subjects”: [“eternalstudent.xyz”], “expiration”: “2022/06/23 14:57:50.000”, “managed”: true, “issuer_key”: “acme-v02.api.letsencrypt.org-directory”, “hash”: “901563658fa59628233c71c4eff86605fd38fdc30849a4948e08e0d4448d12a6”, “cache_size”: 1, “cache_capacity”: 10000}
2022/03/25 16:19:53.737 INFO autosaved config (load with --resume flag) {“file”: “/root/.config/caddy/autosave.json”}
2022/03/25 16:19:53.737 INFO serving initial configuration
2022/03/25 16:19:53.737 INFO tls.cache.maintenance started background certificate maintenance {“cache”: “0xc000656380”}
2022/03/25 16:19:53.737 INFO tls cleaning storage unit {“description”: “FileStorage:/root/.local/share/caddy”}
2022/03/25 16:19:53.738 INFO tls finished cleaning storage units
2022/03/25 16:21:15.751 DEBUG tls.handshake choosing certificate {“identifier”: “eternalstudent.xyz”, “num_choices”: 1}
2022/03/25 16:21:15.752 DEBUG tls.handshake default certificate selection results {“identifier”: “eternalstudent.xyz”, “subjects”: [“eternalstudent.xyz”], “managed”: true, “issuer_key”: “acme-v02.api.letsencrypt.org-directory”, “hash”: “901563658fa59628233c71c4eff86605fd38fdc30849a4948e08e0d4448d12a6”}
2022/03/25 16:21:15.752 DEBUG tls.handshake matched certificate in cache {“subjects”: [“eternalstudent.xyz”], “managed”: true, “expiration”: “2022/06/23 14:57:50.000”, “hash”: “901563658fa59628233c71c4eff86605fd38fdc30849a4948e08e0d4448d12a6”}
2022/03/25 16:21:15.812 DEBUG http.handlers.file_server sanitized path join {“site_root”: “/var/www/html/eternalStudent.xyz”, “request_path”: “/hello”, “result”: “/var/www/html/eternalStudent.xyz/hello”}