We recently performed fresh installs of FreeSwitch 4.4 on both CentOS 7 and Debian 9. We performed the install using the FreeSwitch install scripts on both using the scripts found here: https://www.fusionpbx.com/download.php
On both installs we received a 502 bad gateway error when attempting to access the FusionPBX admin panel.
If you look at the Nginx error log: /var/log/nginx/error.log, you will references to access denied:
2019/04/08 16:57:55 [crit] 22479#0: *3 connect() to unix:/var/run/php-fpm/php-fpm.sock failed (13: Permission denied) while connecting to upstream, client: XXX.XXX.XXX.XXX, server: fusionpbx, request: “GET / HTTP/1.1”, upstream: “fastcgi://unix:/var/run/php-fpm/php-fpm.sock:”, host: “XXX.XXX.XXX.XXX”
The error is caused by Nginx running as user:group freeswitch:daemon and php-fpm using nobody.
To fix the issue, change the user and group in php-fpm. Edit the file: /etc/php-fpm.d/www.conf
Here is an example of the section with updates:
; permissions must be set in order to allow connections from a web server.
; Default Values: user and group are set as the running user
; mode is set to 0660
;listen.owner = nobody
listen.owner = freeswitch
;listen.group = nobody
listen.group = daemon
;listen.mode = 0660
For a quick repair, these SED commands will make the changes.
sed -i ‘email@example.com = firstname.lastname@example.org = freeswitch@’ /etc/php-fpm.d/www.conf
sed -i ‘email@example.com = firstname.lastname@example.org = daemon@’ /etc/php-fpm.d/www.conf
You will also want to restart Nginx and php-fpm.
service php-fpm restart
service nginx restart