2450 W Sample Road STE 11, Pompano beach, FL 33073
Email: info@bytesolutions.com
Phone: +1 (561) 338-9696
Byte Solutions Inc. normal business hours are Monday thru Friday 8:00 AM to 5:00 PM. Emergency support is available 24/7, 365 days.

FusionPBX Error 502 Bad Gateway.

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 ‘s@listen.owner = nobody@listen.owner = freeswitch@’ /etc/php-fpm.d/www.conf
sed -i ‘s@listen.group = nobody@listen.group = daemon@’ /etc/php-fpm.d/www.conf

 

You will also want to restart Nginx and php-fpm.

 

service php-fpm restart
service nginx restart

BytesAdmin
2 Comments
  • Max
    Reply
    Posted at 01:33, 2019-05-21

    It works for me,
    Thanks a lot

  • Matt
    Reply
    Posted at 03:28, 2019-05-23

    I had this problem and these steps resolved it. Thanks for posting

Post a Comment

Comment
Name
Email
Website

Call Now Button