Learn about Centmin Mod LEMP Stack today
Become a Member

Nginx PHP-FPM Getting 502 Bad gateway error Nginx

Discussion in 'Nginx, PHP-FPM & MariaDB MySQL' started by pheonis, Apr 1, 2019.

  1. pheonis

    pheonis Member

    51
    3
    8
    Dec 21, 2018
    Ratings:
    +4
    Local Time:
    7:48 PM
    Hi There,
    i am currently setting a new website on a new server with centminmod, after setup i put my wp files using ftp. Now i am getting 502 Bad gateway error nginx.

    Code:
      tail -10 /usr/local/nginx/logs/error.log
    
    Shows This :
    Code:
    2019/04/01 03:22:03 [alert] 844#844: setpriority(-10) failed (13: Permission denied)
    Code:
    tail -10 /home/nginx/domains/domainname.com/log/access.log


    showed this :

    Code:
    117.227.60.99 - - [01/Apr/2019:10:41:26 +0000] "GET / HTTP/2.0" 502 552 "-" "Mozilla/5.0 (Linux; Android 6.0.1; Redmi 4A Build/MMB29M) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.68 Mobile Safari/537.36"
    117.227.60.99 - - [01/Apr/2019:10:41:33 +0000] "GET / HTTP/2.0" 502 552 "-" "Mozilla/5.0 (Linux; Android 6.0.1; Redmi 4A Build/MMB29M) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.68 Mobile Safari/537.36"
    

    I am unable to resolve the issue. Can you shed some light @eva2000 into the issue.

    Thank you
     
  2. eva2000

    eva2000 Administrator Staff Member

    39,745
    8,767
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +13,488
    Local Time:
    12:18 AM
    Nginx 1.15.x
    MariaDB 5.5/10.x
    Need all info below

    Please fill in any relevant information that applies to you:
    • CentOS Version: i.e. CentOS 6 32bit or 64bit / CentOS 7 64bit ?
    • Centmin Mod Version Installed: i.e. 123.08stable or 123.09beta01
    • Nginx Version Installed: i.e. 1.15.3
    • PHP Version Installed: i.e. 5.6.37, 7.0.31, 7.1.21, 7.2.9
    • MariaDB MySQL Version Installed: i.e. 10.0.x or 10.1.xx or 10.2.xx
    • When was last time updated Centmin Mod code base ? : i.e. run centmin.sh menu option 23 submenu option 2 or cmupdate command
    • Persistent Config: Do you have any persistent config file options set in /etc/centminmod/custom_config.inc ? You can check via this command:
      Code (Text):
      cat /etc/centminmod/custom_config.inc
      

      Post output in CODE tags.

    Also Getting Started Guide step 2 for after you create nginx vhost and if you uploaded files via root user sftp need to chown and chmod permissions to nginx user/group.

    Also if you're using OpenVZ 7 based CentOS 7 you may have run into issue @jcat had https://community.centminmod.com/threads/php-fpm-fails-to-start-on-openvz7.17045/. So if you are using OpenVZ 7 based VPS with CentOS 7 you may need to edit /etc/systemd/system/php-fpm.service.d/limit.conf to remove the line
    Code (Text):
    Nice=-10

    then restart php-fpm service
    Code (Text):
    systemctl daemon-reload
    systemctl restart php-fpm
    
     
..