502 Bad Gateway with fastcgi

Caddy 0.10.3

http://25.4.88.33:80

root /home/caddy/root/

git {
    path	launcher-update
    repo	http://25.4.88.33:3000/Minecraft/Launcher.git
    branch	update-site
}

fastcgi / /var/run/php/php7.0-fpm.sock {
    ext 	.php
    split	.php
    #index	index.php
}

Error:

17/Jun/2017:20:47:53 -0500 [ERROR 502 /launcher-update/packages.php] dial unix /var/run/php/php7.0-fpm.sock: connect: permission denied

Does anyone know what’s up? I don’t seem to be skilled enough to find exactly which of the solutions for various 502 errors I need.

It looks like the FastCGI proxy can’t open the unix socket because of a permissions issue. This might be caused by the user your PHP-FPM is configured to listen for is not the same as the user Caddy is running as. In PHP’s www.conf, there should be listen.user and listen.group settings for the socket.

1 Like

@Whitestrake Thank you, that was it! I ran sudo usermod -a -G www-data caddy to add my caddy user (I have a user specifically for Caddy to keep stuff compartmentalized) to the www-data group and uncommented the line listen.mode = 0660 in /etc/php/7.0/fpm/pool.d/www.conf, and now it works!

1 Like

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