I just installed Caddy and my main website is working correctly (mainly due to it being strictly HTML); however, my subdomain site isn’t working at all. Everytime I try to connect to it I get this error message…
[ERROR 502 /index.php] dial tcp 127.0.0.1:9000: connectex: No connection could be made because the target machine actively refused it.
Here is a copy of my Caddyfile
I had to put it on pastebin due to the link limits Caddy imposes on new accounts.
I have made sure all the ports are opened but I constantly receive that previous error in the Caddy console window and a 502 Bad Gateway on the client web browser trying to connect.
So from some digging I see it appears Caddy isn’t starting php-cgi because if I manually start it, it will work but I can’t get Caddy to do it for me thru the Caddyfile.
I solved my problem though by creating a tiny batch file that runs “E:\PHP\php-cgi.exe -b 9000” on boot and another batch file that starts Caddy on boot. Nothing I tried could get caddy to launch php-cgi so I removed that from my caddy file and created a window service to launch it separately and its been working for me. I know its not ideal but hey done 5 reboots on the system and runs perfectly everytime.