Welcome to Centmin Mod Community
Register Now

502 Bad Gateway error after moving site to new host

Discussion in 'Nginx, PHP-FPM & MariaDB MySQL' started by Dnyan, Aug 4, 2019.

  1. Dnyan

    Dnyan Member

    55
    9
    8
    Sep 16, 2017
    Ratings:
    +11
    Local Time:
    11:36 PM
    1.17.2
    10.1.41
    I am getting 502 Bad Gateway error.

    On restarting php-fpm i get and error, rest all module restarts without any error.

    Code:
    systemctl status php-fpm.service
    ● php-fpm.service - PHP FastCGI Process Manager
       Loaded: loaded (/usr/lib/systemd/system/php-fpm.service; enabled; vendor preset: disabled)
      Drop-In: /etc/systemd/system/php-fpm.service.d
               └─limit.conf
       Active: failed (Result: exit-code) since Sat 2019-08-03 23:18:26 UTC; 21s ago
      Process: 25574 ExecStop=/bin/kill -s QUIT $MAINPID (code=exited, status=1/FAILURE)
      Process: 25572 ExecStart=/usr/local/sbin/php-fpm --daemonize --fpm-config /usr/local/etc/php-fpm.conf --pid /var/run/php-fpm/php-fpm.pid (code=exited, status=70)
     Main PID: 25572 (code=exited, status=70)
    
    in journalctl -xn

    i see kernel: Firewall: *TCP_IN Blocked* IN=ens192 OUT=

    Can anyone guide me on what i should do now.

    Thanks
     
    Last edited: Aug 4, 2019
  2. eva2000

    eva2000 Administrator Staff Member

    41,080
    9,188
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +14,097
    Local Time:
    4:06 AM
    Nginx 1.15.x
    MariaDB 5.5/10.x
    What's output for these 2 commands
    Code (Text):
    fpm-errlog

    Code (Text):
    fpm-phperrlog


    both old and new servers using same version of centmin mod ? nginx and php-fpm ? try recompile nginx and php-fpm on new server via centmin.sh menu option 4 and 5 respectively

    When you create a new nginx vhost domain via centmin.sh menu option 2 or menu option 22 or via /usr/bin/nv cli command line, you will create the Nginx vhost files and directories. You will get an outputted the path location where it will create the domain name's vhost conf file named newdomain.com.conf (and newdomain.com.ssl.conf if you selected yes to self signed SSL)
    • Nginx vhost conf path will be at /usr/local/nginx/conf/conf.d/newdomain.com.conf
    • Nginx HTTP/2 SSL vhost conf path will be at /usr/local/nginx/conf/conf.d/newdomain.com.ssl.conf
    • Nginx Self-Signed SSL Certificate Directory at /usr/local/nginx/conf/ssl/newdomain.com
    • Vhost public web root will be at /home/nginx/domains/newdomain.com/public
    • Vhost log directory will be at /home/nginx/domains/newdomain.com/log
    Please post the contents of /usr/local/nginx/conf/conf.d/newdomain.com.conf and if applicable /usr/local/nginx/conf/conf.d/newdomain.com.ssl.conf wrapped in CODE tags (outlined at How to use forum BBCODE code tags)

    what is output of these commands in ssh
    Code (Text):
    curl -I https://domain.com
    

    Code (Text):
    curl -I https://www.domain.com
    

    Code (Text):
    curl -I http://domain.com
    

    Code (Text):
    curl -I http://www.domain.com
    

    wrap output in CODE tags
     
  3. Dnyan

    Dnyan Member

    55
    9
    8
    Sep 16, 2017
    Ratings:
    +11
    Local Time:
    11:36 PM
    1.17.2
    10.1.41
    old server had cent OS 6
    new one have Cent OS7

    PHP version installed is same.

    recompiled twice via option 4 and 5, still getting same error
     
  4. eva2000

    eva2000 Administrator Staff Member

    41,080
    9,188
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +14,097
    Local Time:
    4:06 AM
    Nginx 1.15.x
    MariaDB 5.5/10.x
    still need info requested also did you copy over /usr/local/nginx/conf and /usr/local/nginx/conf.d contents ? as centos 6 and 7 may have some differences i.e. centos 7 php-fpm now uses systemd instead of init.d service file so depending how you customised php-fpm settings on old server, you might have brought over incompatible changes
     
  5. Dnyan

    Dnyan Member

    55
    9
    8
    Sep 16, 2017
    Ratings:
    +11
    Local Time:
    11:36 PM
    1.17.2
    10.1.41
  6. eva2000

    eva2000 Administrator Staff Member

    41,080
    9,188
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +14,097
    Local Time:
    4:06 AM
    Nginx 1.15.x
    MariaDB 5.5/10.x
    try with no pager to see further back into history
    Code (Text):
    fpmrestart
    journalctl -xe --no-pager -n50 -u php-fpm

    or
    Code (Text):
    fpmrestart
    journalctl -xe --no-pager -n50 -o json-pretty -u php-fpm
     
  7. eva2000

    eva2000 Administrator Staff Member

    41,080
    9,188
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +14,097
    Local Time:
    4:06 AM
    Nginx 1.15.x
    MariaDB 5.5/10.x
    wouldn't know until i get the info asked in 2nd post
     
  8. Dnyan

    Dnyan Member

    55
    9
    8
    Sep 16, 2017
    Ratings:
    +11
    Local Time:
    11:36 PM
    1.17.2
    10.1.41
    this is what i got in it
    Code:
     
     Firewall: *TCP_IN Blocked* IN=ens192 OUT
    Aug 04 02:14:27 my.server.com polkitd[838]: Registered Authentication Agent fo
    Aug 04 02:14:27 my.server.com systemd[1]: Starting PHP FastCGI Process Manager
    -- Subject: Unit php-fpm.service has begun start-up
    -- Defined-By: systemd
    -- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
    [02:30][[email protected] ~]# fpmrestart
    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.
    Restarting php-fpm (via systemctl) [  OK  ]
    [02:30][[email protected] ~]# journalctl -xe --no-pager -n50
    -- Logs begin at Sun 2019-08-04 00:48:21 UTC, end at Sun 2019-08-04 02:30:17 UTC. --
    Aug 04 02:23:59 my.server.com kernel: Firewall: *ICMP_IN Blocked* IN=ens192 OUT= MAC=ipv6 SRC=47.89.113.3 0 LEN=44 TOS=0x00 PREC=0x00 TTL=57 ID=0 DF PROTO=ICMP TYPE=8 CODE=0 ID=316 SEQ=16
    Aug 04 02:24:00 my.server.com kernel: Firewall: *ICMP_IN Blocked* IN=ens192 OUT= MAC=ipv6 SRC=47.89.113.3 0 LEN=44 TOS=0x00 PREC=0x00 TTL=57 ID=0 DF PROTO=ICMP TYPE=8 CODE=0 ID=316 SEQ=18
    Aug 04 02:24:01 my.server.com kernel: Firewall: *ICMP_IN Blocked* IN=ens192 OUT= MAC=ipv6 SRC=47.89.113.3 0 LEN=44 TOS=0x00 PREC=0x00 TTL=57 ID=0 DF PROTO=ICMP TYPE=8 CODE=0 ID=316 SEQ=20
    Aug 04 02:24:05 my.server.com kernel: Firewall: *TCP_IN Blocked* IN=ens192 OUT= MAC=ipv6 SRC=77.83.173.96 0 LEN=40 TOS=0x00 PREC=0x00 TTL=245 ID=53509 PROTO=TCP SPT=53370 DPT=5640 WINDOW=1024 RES=0x00 SYN URGP=0
    Aug 04 02:24:37 my.server.com kernel: Firewall: *TCP_IN Blocked* IN=ens192 OUT= MAC=ipv6 SRC=77.83.173.96 0 LEN=40 TOS=0x00 PREC=0x00 TTL=245 ID=14308 PROTO=TCP SPT=53370 DPT=4549 WINDOW=1024 RES=0x00 SYN URGP=0
    Aug 04 02:24:39 my.server.com kernel: Firewall: *TCP_IN Blocked* IN=ens192 OUT= MAC=ipv6 SRC=103.129.64.49 0 LEN=44 TOS=0x00 PREC=0x00 TTL=247 ID=4069 DF PROTO=TCP SPT=55864 DPT=7547 WINDOW=14600 RES=0x00 SYN URGP=0
    Aug 04 02:24:51 my.server.com kernel: Firewall: *TCP_IN Blocked* IN=ens192 OUT= MAC=ipv6 SRC=77.247.108.119 0 LEN=40 TOS=0x08 PREC=0x20 TTL=241 ID=52068 PROTO=TCP SPT=59628 DPT=5038 WINDOW=1024 RES=0x00 SYN URGP=0
    Aug 04 02:24:55 my.server.com kernel: Firewall: *TCP_IN Blocked* IN=ens192 OUT= MAC=ipv6 SRC=103.129.104.138 0 LEN=40 TOS=0x00 PREC=0x00 TTL=246 ID=36363 DF PROTO=TCP SPT=28500 DPT=8291 WINDOW=14600 RES=0x00 SYN URGP=0
    Aug 04 02:25:01 my.server.com systemd[1]: Started Session 28 of user root.
    -- Subject: Unit session-28.scope has finished start-up
    -- Defined-By: systemd
    -- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
    --
    -- Unit session-28.scope has finished starting up.
    --
    -- The start-up result is done.
    Aug 04 02:25:01 my.server.com CROND[26555]: (root) CMD (/usr/lib64/sa/sa1 1 1)
    Aug 04 02:25:13 my.server.com kernel: Firewall: *TCP_IN Blocked* IN=ens192 OUT= MAC= SRC= DST= LEN=40 TOS=0x00 PREC=0x00 TTL=245 ID=43187 PROTO=TCP SPT=52368 DPT=2087 WINDOW=1024 RES=0x00 SYN URGP=0
    Aug 04 02:25:43 my.server.com kernel: Firewall: *TCP_IN Blocked* IN=ens192 OUT= MAC=ipv6 SRC=LEN=40 TOS=0x00 PREC=0x00 TTL=247 ID=14863 DF PROTO=TCP SPT=41380 DPT=23 WINDOW=14600 RES=0x00 SYN URGP=0
    Aug 04 02:25:47 my.server.com kernel: Firewall: *TCP_IN Blocked* IN=ens192 OUT= MAC=ipv6 SRC= LEN=40 TOS=0x00 PREC=0x00 TTL=246 ID=47739 PROTO=TCP SPT=59265 DPT=25081 WINDOW=1024 RES=0x00 SYN URGP=0
    Aug 04 02:26:30 my.server.com kernel: Firewall: *TCP_IN Blocked* IN=ens192 OUT= MAC=ipv6 SRC=0 LEN=44 TOS=0x00 PREC=0x00 TTL=241 ID=6420 DF PROTO=TCP SPT=19903 DPT=23 WINDOW=14600 RES=0x00 SYN URGP=0
    Aug 04 02:26:42 my.server.com kernel: Firewall: *TCP_IN Blocked* IN=ens192 OUT= MAC=ipv6 SRC= 0 LEN=40 TOS=0x00 PREC=0x00 TTL=242 ID=9772 DF PROTO=TCP SPT=34777 DPT=8291 WINDOW=14600 RES=0x00 SYN URGP=0
    Aug 04 02:26:49 my.server.com kernel: Firewall: *TCP_IN Blocked* IN=ens192 OUT= MAC=ipv6 SRC= 0 LEN=40 TOS=0x00 PREC=0x00 TTL=247 ID=65246 PROTO=TCP SPT=54121 DPT=3397 WINDOW=1024 RES=0x00 SYN URGP=0
    Aug 04 02:26:57 my.server.com kernel: Firewall: *TCP_IN Blocked* IN=ens192 OUT= MAC=ipv6 SRC= 0 LEN=40 TOS=0x00 PREC=0x00 TTL=247 ID=59918 PROTO=TCP SPT=48940 DPT=26788 WINDOW=1024 RES=0x00 SYN URGP=0
    Aug 04 02:26:58 my.server.com kernel: Firewall: *TCP_IN Blocked* IN=ens192 OUT= MAC=ipv6 SRC= 0 LEN=44 TOS=0x00 PREC=0x00 TTL=247 ID=30939 DF PROTO=TCP SPT=50769 DPT=8291 WINDOW=14600 RES=0x00 SYN URGP=0
    Aug 04 02:27:07 my.server.com kernel: Firewall: *UDP_IN Blocked* IN=ens192 OUT= MAC=ipv6 SRC= 0 LEN=76 TOS=0x00 PREC=0x00 TTL=248 ID=54321 PROTO=UDP SPT=38893 DPT=123 LEN=56
    Aug 04 02:27:09 my.server.com kernel: Firewall: *TCP_IN Blocked* IN=ens192 OUT= MAC=ipv6 SRC=0 LEN=40 TOS=0x00 PREC=0x00 TTL=245 ID=54321 PROTO=TCP SPT=51641 DPT=8088 WINDOW=65535 RES=0x00 SYN URGP=0
    Aug 04 02:27:14 my.server.com kernel: Firewall: *TCP_IN Blocked* IN=ens192 OUT= MAC=ipv6 SRC= 0 LEN=40 TOS=0x00 PREC=0x00 TTL=245 ID=17937 PROTO=TCP SPT=53370 DPT=4944 WINDOW=1024 RES=0x00 SYN URGP=0
    Aug 04 02:27:32 my.server.com kernel: Firewall: *TCP_IN Blocked* IN=ens192 OUT= MAC=ipv6 SRC=0 LEN=40 TOS=0x00 PREC=0x00 TTL=247 ID=16501 PROTO=TCP SPT=56479 DPT=3541 WINDOW=1024 RES=0x00 SYN URGP=0
    Aug 04 02:27:36 my.server.com kernel: Firewall: *TCP_IN Blocked* IN=ens192 OUT= MAC=ipv6 SRC= 0 LEN=40 TOS=0x00 PREC=0x00 TTL=245 ID=39984 PROTO=TCP SPT=52166 DPT=7826 WINDOW=1024 RES=0x00 SYN URGP=0
    Aug 04 02:28:28 my.server.com kernel: Firewall: *TCP_IN Blocked* IN=ens192 OUT= MAC=ipv6 SRC=0 LEN=40 TOS=0x00 PREC=0x00 TTL=247 ID=53331 PROTO=TCP SPT=56479 DPT=3628 WINDOW=1024 RES=0x00 SYN URGP=0
    Aug 04 02:28:37 my.server.com kernel: Firewall: *TCP_IN Blocked* IN=ens192 OUT= MAC=ipv6 SRC=0 LEN=40 TOS=0x00 PREC=0x00 TTL=244 ID=6983 DF PROTO=TCP SPT=61482 DPT=23 WINDOW=14600 RES=0x00 SYN URGP=0
    Aug 04 02:28:53 my.server.com kernel: Firewall: *TCP_IN Blocked* IN=ens192 OUT= MAC=ipv6 SRC= 0 LEN=40 TOS=0x00 PREC=0x00 TTL=247 ID=62603 DF PROTO=TCP SPT=57495 DPT=7547 WINDOW=14600 RES=0x00 SYN URGP=0
    Aug 04 02:28:55 my.server.com kernel: Firewall: *TCP_IN Blocked* IN=ens192 OUT= MAC=ipv6 SRC= LEN=40 TOS=0x00 PREC=0x00 TTL=246 ID=37147 PROTO=TCP SPT=49670 DPT=6258 WINDOW=1024 RES=0x00 SYN URGP=0
    Aug 04 02:29:29 my.server.com kernel: Firewall: *TCP_IN Blocked* IN=ens192 OUT= MAC=ipv6 SRC=N=40 TOS=0x00 PREC=0x00 TTL=246 ID=14635 DF PROTO=TCP SPT=17097 DPT=8291 WINDOW=14600 RES=0x00 SYN URGP=0
    Aug 04 02:29:33 my.server.com kernel: Firewall: *TCP_IN Blocked* IN=ens192 OUT= MAC=ipv6 SRC=40 TOS=0x00 PREC=0x00 TTL=247 ID=56157 PROTO=TCP SPT=48940 DPT=21907 WINDOW=1024 RES=0x00 SYN URGP=0
    Aug 04 02:29:42 my.server.com kernel: Firewall: *TCP_IN Blocked* IN=ens192 OUT= MAC=ipv6 SRC=EN=40 TOS=0x00 PREC=0x00 TTL=246 ID=871 PROTO=TCP SPT=42692 DPT=64549 WINDOW=1024 RES=0x00 SYN URGP=0
    Aug 04 02:29:44 my.server.com kernel: Firewall: *UDP_IN Blocked* IN=ens192 OUT= MAC=ipv6 SRC=6 0 LEN=40 TOS=0x00 PREC=0x00 TTL=56 ID=23102 DF PROTO=UDP SPT=54424 DPT=123 LEN=20
    Aug 04 02:29:45 my.server.com kernel: Firewall: *TCP_IN Blocked* IN=ens192 OUT= MAC=ipv6 SRC=LEN=40 TOS=0x00 PREC=0x00 TTL=247 ID=13612 DF PROTO=TCP SPT=58186 DPT=7547 WINDOW=14600 RES=0x00 SYN URGP=0
    Aug 04 02:29:45 my.server.com kernel: Firewall: *TCP_IN Blocked* IN=ens192 OUT= MAC=ipv6 SRC=8 0 LEN=40 TOS=0x00 PREC=0x00 TTL=247 ID=50166 PROTO=TCP SPT=48940 DPT=17749 WINDOW=1024 RES=0x00 SYN URGP=0
    Aug 04 02:29:59 my.server.com kernel: Firewall: *TCP_IN Blocked* IN=ens192 OUT= MAC=ipv6 SRC=9 0 LEN=44 TOS=0x00 PREC=0x00 TTL=247 ID=64588 DF PROTO=TCP SPT=46010 DPT=7547 WINDOW=14600 RES=0x00 SYN URGP=0
    Aug 04 02:30:01 my.server.com systemd[1]: Started Session 29 of user root.
    -- Subject: Unit session-29.scope has finished start-up
    -- Defined-By: systemd
    -- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
    --
    -- Unit session-29.scope has finished starting up.
    --
    -- The start-up result is done.
    Aug 04 02:30:01 my.server.com systemd[1]: Started Session 30 of user root.
    -- Subject: Unit session-30.scope has finished start-up
    -- Defined-By: systemd
    -- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
    --
    -- Unit session-30.scope has finished starting up.
    --
    -- The start-up result is done.
    Aug 04 02:30:01 my.server.com CROND[26851]: (root) CMD (/usr/lib64/sa/sa1 1 1)
    Aug 04 02:30:01 my.server.com CROND[26852]: (root) CMD (/usr/bin/sh /scripts/monitor.sh >> /scripts/monitor.txt)
    Aug 04 02:30:16 my.server.com polkitd[838]: Registered Authentication Agent for unix-process:26915:611566 (system bus name :1.107 [/usr/bin/pkttyagent --notify-fd 5 --fallback], object path /org/freedesktop/PolicyKit1/AuthenticationAgent, locale en_US.UTF-8)
    Aug 04 02:30:16 my.server.com systemd[1]: Reloading.
    Aug 04 02:30:16 my.server.com polkitd[838]: Unregistered Authentication Agent for unix-process:26915:611566 (system bus name :1.107, object path /org/freedesktop/PolicyKit1/AuthenticationAgent, locale en_US.UTF-8) (disconnected from bus)
    Aug 04 02:30:16 my.server.com polkitd[838]: Registered Authentication Agent for unix-process:26933:611574 (system bus name :1.108 [/usr/bin/pkttyagent --notify-fd 5 --fallback], object path /org/freedesktop/PolicyKit1/AuthenticationAgent, locale en_US.UTF-8)
    Aug 04 02:30:16 my.server.com systemd[1]: Starting PHP FastCGI Process Manager...
    -- Subject: Unit php-fpm.service has begun start-up
    -- Defined-By: systemd
    -- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
    --
    -- Unit php-fpm.service has begun starting up.
    Aug 04 02:30:17 my.server.com php-fpm[26939]: [04-Aug-2019 02:30:17] ERROR: [pool phpmyadmin] cannot get uid for user 'phpmyadmin'
    Aug 04 02:30:17 my.server.com php-fpm[26939]: [04-Aug-2019 02:30:17] ERROR: FPM initialization failed
    Aug 04 02:30:17 my.server.com systemd[1]: php-fpm.service: control process exited, code=exited status=70
    Aug 04 02:30:17 my.server.com systemd[1]: Failed to start PHP FastCGI Process Manager.
    -- Subject: Unit php-fpm.service has failed
    -- Defined-By: systemd
    -- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
    --
    -- Unit php-fpm.service has failed.
    --
    -- The result is failed.
    Aug 04 02:30:17 my.server.com systemd[1]: Unit php-fpm.service entered failed state.
    Aug 04 02:30:17 my.server.com systemd[1]: php-fpm.service failed.
    Aug 04 02:30:17 my.server.com polkitd[838]: Unregistered Authentication Agent for unix-process:26933:611574 (system bus name :1.108, object path /org/freedesktop/PolicyKit1/AuthenticationAgent, locale en_US.UTF-8) (disconnected from bus)
    [02:30][[email protected] ~]#
    
    
    it tried to login to mysql with password but had got msg login with password access denied on cli
     
  9. Dnyan

    Dnyan Member

    55
    9
    8
    Sep 16, 2017
    Ratings:
    +11
    Local Time:
    11:36 PM
    1.17.2
    10.1.41
    Issue is solve now, please forgive this basic coder for disturbing.

    i installed phpmyadmin which i uninstalled now and website is working back.

    is there any way to know, if any file had got damaged so that, i can resetup the hole thing again from my old live server.
     
  10. eva2000

    eva2000 Administrator Staff Member

    41,080
    9,188
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +14,097
    Local Time:
    4:06 AM
    Nginx 1.15.x
    MariaDB 5.5/10.x
    yup clue was
    related to centos 7 change to using php-fpm systemd service instead of init.d, phpmyadmin php-fpm unix sockets isn't properly working in php-fpm systemd setup - so uninstall phpmyadmin and update phpmyadmin.sh script to latest one / redownload https://centminmod.com/addon_phpmyadmin.html and install phpmyadmin.sh again if you need it, updated script changes php-fpm for phpmyadmin to use php-fpm systemd setup
     
  11. Dnyan

    Dnyan Member

    55
    9
    8
    Sep 16, 2017
    Ratings:
    +11
    Local Time:
    11:36 PM
    1.17.2
    10.1.41
    Thank you for the Support and your wonderful articles which helped me a lot during past years.

    There is still a lot which need to be learnt and peoples wont try unless they get caught in troubles.

    Patience and reading each line posted by you is important.

    I started with installation of centminmod on new server by going to installation guide and copy pasted the first line of code which was for stable version and after that till its install my mind was wondering with to find solutions for installation of beta version.

    This is why i love centminmod, because everything is there but choice is ours, if do type wrong command, we definitely gonna land in troubles.

    Soon in Coming year will try my level best to support the centminmod.

    Thanks @eva2000
     
    • Like Like x 1
  12. eva2000

    eva2000 Administrator Staff Member

    41,080
    9,188
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +14,097
    Local Time:
    4:06 AM
    Nginx 1.15.x
    MariaDB 5.5/10.x
    • Like Like x 1