CGI scripts are not executing on a Mac

1. The problem I’m having:

CGI scripts are not executing. I believe it has something to do with FCGIWRAP and not CADDY but any help will be appreciated.

2. Error messages and/or full log output:

ERROR http.log.error.log0 dialing backend: dial unix /opt/homebrew/sbin/fcgiwrap: connect: socket operation on non-socket {“request”: {“remote_ip”: “::1”, “remote_port”: “51890”, “client_ip”: “::1”, “proto”: “HTTP/1.1”, “method”: “GET”, “host”: “localhost”, “uri”: “/test.cgi”, “headers”: {“Accept-Language”: [“en-US,en;q=0.9”], “User-Agent”: [“Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.4 Safari/605.1.15”], “Priority”: [“u=0, i”], “Upgrade-Insecure-Requests”: [“1”], “Sec-Fetch-Site”: [“none”], “Sec-Fetch-Mode”: [“navigate”], “Accept-Encoding”: [“gzip, deflate”], “Sec-Fetch-Dest”: [“document”], “Accept”: [“text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8”], “Connection”: [“keep-alive”]}}, “duration”: 0.001221875, “status”: 502, “err_id”: “q30k6hm72”, “err_trace”: “reverseproxy.statusError (reverseproxy.go:1525)”}

3. Caddy version:

v2.11.2

4. How I installed and ran Caddy:

Downloaded binary and ran ./caddy run

a. System environment:

macOS TAHOE 26.4.1

b. Command:

./caddy run

d. My complete Caddy config:

:80 {
root * /Applications/caddy
    log {
        output file /Applications/caddy/caddy.log
    }
	@cgi path *.cgi
	try_files {path} /index.cgi
	reverse_proxy @cgi unix//opt/homebrew/sbin/fcgiwrap {
		transport fastcgi {
			split .cgi
		}
	}
	file_server
}

What is the output of ls -l /opt/homebrew/sbin/fcgiwrap ?

% ls -l /opt/homebrew/sbin/fcgiwrap

lrwxr-xr-x 1 apple admin 38 Apr 22 17:04 /opt/homebrew/sbin/fcgiwrap → ../Cellar/fcgiwrap/1.1.0/sbin/fcgiwrap

any suggestion of what the issue could be ?

Simple, I think: /opt/homebrew/sbin/fcgiwrap is not a socket. That appears to be a link to an executable binary.

(post deleted by author)