Welcome to Centmin Mod Community
Register Now

phpmyadmin.sh Error 502 bad gateway / nginx failed restart

Discussion in 'Add Ons' started by brainlet2000, Mar 1, 2021.

  1. brainlet2000

    brainlet2000 Member

    39
    4
    8
    Jan 21, 2020
    Ratings:
    +7
    Local Time:
    12:17 AM
    1.17.7
    10.3.21
    Please fill in any relevant information that applies to you:
    • CentOS Version: iCentOS Linux 7.9.2009
    • Centmin Mod Version Installed: i.e. 123.08stable or 123.09beta01
    • Nginx Version Installed: 1.19.7
    • PHP Version Installed:
    • MariaDB MySQL Version Installed: x
    • When was last time updated Centmin Mod code base ? : yesterday
    • Persistent Config:
      Code:
      LETSENCRYPT_DETECT='y'
      NGXDYNAMIC_NGXPAGESPEED='y'
      NGINX_PAGESPEED='y'
      
      
    OK so I ran the following commands because I was having issues with my PhpMyAdmin:

    SSL - Letsencrypt - Phpmyadmin: There is a mismatch between HTTPS indicated on the server and client.

    So I first ran
    Code:
    /root/tools/phpmyadmin_uninstall.sh
    After that got the following errors:
    Code:
    rm -rf /usr/local/nginx/html/3018_mysqladmin5262
    
    rm -rf /root/tools/phpmyadmin_update.sh
    
    rm -rf /usr/local/nginx/conf/conf.d/phpmyadmin_ssl.conf
    
    rm -rf /usr/local/nginx/conf/php_3018_mysqladmin5262.conf
    
    rm -rf /usr/local/nginx/conf/phpfpmd/phpfpm_myadmin.conf
    
    rm -rf /usr/local/nginx/conf/htpassphpmyadmin
    
    rm -rf /usr/local/nginx/conf/phpmyadmin_https.conf
    
    rm -rf /usr/local/nginx/conf/phpmyadmin.conf
    
    rm -rf /usr/local/nginx/conf/phpmyadmin_check
    
    Restarting nginx (via systemctl):  Job for nginx.service failed because the control process exited with error code. See "systemctl status nginx.service" and "journalctl -xe" for details.
    
    [FAILED]
    
    
    Redirecting to /bin/systemctl restart php-fpm.service
    
    Job for php-fpm.service failed because the control process exited with error code. See "systemctl status php-fpm.service" and "journalctl -xe" for details.
    
    [00:53][root@ ~]#
    
    [00:53][root@ ~]# ngxrestart
    
    Restarting nginx (via systemctl):  Job for nginx.service failed because the control process exited with error code. See "systemctl status nginx.service" and "journalctl -xe" for details.
    
                                                              [FAILED]
    
    [00:54][root@ ~]# ngxrestart
    
    Restarting nginx (via systemctl):  Job for nginx.service failed because the control process exited with error code. See "systemctl status nginx.service" and "journalctl -xe" for details.
    
                                                              [FAILED]
    
    [00:54][root@ ~]# systemctl status nginx.service
    
    ‚óŹ nginx.service - SYSV: Nginx is an HTTP(S) server, HTTP(S) reverse proxy and IMAP/POP3 proxy server
    
       Loaded: loaded (/etc/rc.d/init.d/nginx; bad; vendor preset: disabled)
    
       Active: failed (Result: exit-code) since Mon 2021-03-01 00:54:13 UTC; 16s ago
    
        Docs: man:systemd-sysv-generator(8)
    
      Process: 46814 ExecStop=/etc/rc.d/init.d/nginx stop (code=exited, status=0/SUCCESS)
    
      Process: 46929 ExecStart=/etc/rc.d/init.d/nginx start (code=exited, status=1/FAILURE)
    
     Main PID: 5610 (code=exited, status=0/SUCCESS)
    
    These are the errors in the error log:

    Code:
    021/03/01 01:20:30 [error] 48773#48773: *16 connect() failed (111: Connection refused) while connecting to upstream, client
    It said something about composer not being installed during the phpmyadmin uninstall.
    I rebuilt nginx with the menu option. Since then nginx restarts, but now it's giving me "error 502 bad gateway" for the entire website and I have literally no idea how this is possible. And I had to do it on a live server of course.

    What could have gone wrong? @eva2000. I'm baffled.
     
    Last edited: Mar 1, 2021
  2. brainlet2000

    brainlet2000 Member

    39
    4
    8
    Jan 21, 2020
    Ratings:
    +7
    Local Time:
    12:17 AM
    1.17.7
    10.3.21
    OK so apparently this completely deleted PHP? What the hell? Reinstalling it as we speak.. I hope this will fix it.
     
  3. brainlet2000

    brainlet2000 Member

    39
    4
    8
    Jan 21, 2020
    Ratings:
    +7
    Local Time:
    12:17 AM
    1.17.7
    10.3.21
    OK, I fixed it by reinstalling PHP. That was extremely dodgy to say the least. How is this possible? That script somehow uninstalled nginx and PHP.
     
  4. eva2000

    eva2000 Administrator Staff Member

    46,427
    10,551
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +16,371
    Local Time:
    8:17 AM
    Nginx 1.19.x
    MariaDB 5.5/10.x
    when you get errors like this nginx and php-fpm haven't been removed but configuration issues are preventing the services from starting

    for nginx usually a nginx config check can tell you the problem
    Code (Text):
    nginx -t
    

    or for both as the error message states, you can use journalctl command to check for nginx and php-fpm respectively like below

    for nginx
    Code (Text):
    journalctl -xe -u nginx --no-pager -S today -o json-pretty

    for php-fpm
    Code (Text):
    journalctl -xe -u php-fpm --no-pager -S today -o json-pretty


    How old is your Centmin Mod install?

    Each time you run phpmyadmin.sh install, a log is created. You can inspect the log in /root/centminlogs and would be named with a date timestamp like centminmod_phpmyadmin_install_010321-074432.log. DO NOT post this log publicly as it would have sensitive info including login info. But you can check it to see if there's errors
    Code (Text):
    ls -lrt /root/centminlogs/ | grep 'centminmod_phpmyadmin_install'
    -rw-r--r--  1 root root   22207 Mar  1 07:48 centminmod_phpmyadmin_install_010321-074432.log
    
     
  5. eva2000

    eva2000 Administrator Staff Member

    46,427
    10,551
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +16,371
    Local Time:
    8:17 AM
    Nginx 1.19.x
    MariaDB 5.5/10.x
    Also I recently updated phpmyadmin.sh so might want to try the newer version too