Subdomain Website in PHP connection error

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 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.

What OS are you using?

I’m using Windows 10

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.

See that topic: Fix - php-cgi.exe quits after exactly 500 hits on Windows or 502 bad gateway errors

I mention an issue you may encounter and how to do it in a caddyfile.

I tested it on Windows 7 x64, but I believe it may work for Windows 10 as well.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.