After Upgrade to Ubuntu 18.04.01 all websites get 502

Discussion in 'ISPConfig 3 Priority Support' started by DantePasquale, Nov 30, 2018.

  1. DantePasquale

    DantePasquale Member HowtoForge Supporter

    Hi,
    Not really sure how to debug this, but I've just upgraded to 18.04.01 on my test machine. Everything works fine, except now all websites (including control panel) return
    ERROR 502 - Bad Gateway!
    I really don't know where to start with this, but suspect PHP upgrade is causing issues.
    Where should I begin debugging this?
    Access.log
    Code:
    66.249.75.153 - - [30/Nov/2018:14:35:18 -0500] "GET /photos/index.php?/categories/flat/start-315&mobile=false&mobile=true HTTP/1.1" 502 1881 "-" "Mozilla/5.0 (Linux; Android 6.0.1; Nexus 5X Build/MMB29P) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2272.96 Mobile Safari/537.36 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)"
    192.0.91.177 - - [30/Nov/2018:14:35:35 -0500] "HEAD /blog HTTP/1.1" 301 0 "-" "jetmon/1.0 (Jetpack Site Uptime Monitor by WordPress.com)"
    192.0.91.177 - - [30/Nov/2018:14:35:35 -0500] "HEAD /blog/ HTTP/1.1" 502 0 "-" "jetmon/1.0 (Jetpack Site Uptime Monitor by WordPress.com)"
    99.78.112.49 - - [30/Nov/2018:14:39:39 -0500] "GET /photos/index.php HTTP/1.1" 502 1881 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36"
    66.249.75.151 - - [30/Nov/2018:14:40:06 -0500] "GET /photos/picture.php?/195/categories&mobile=false&mobile=true HTTP/1.1" 502 1881 "-" "Mozilla/5.0 (Linux; Android 6.0.1; Nexus 5X Build/MMB29P) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2272.96 Mobile Safari/537.36 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)"
    192.0.91.177 - - [30/Nov/2018:14:41:03 -0500] "HEAD /blog HTTP/1.1" 301 0 "-" "jetmon/1.0 (Jetpack Site Uptime Monitor by WordPress.com)"
    192.0.91.177 - - [30/Nov/2018:14:41:04 -0500] "HEAD /blog/ HTTP/1.1" 502 0 "-" "jetmon/1.0 (Jetpack Site Uptime Monitor by WordPress.com)"
    
    And error.log

    Code:
    2018/11/30 14:35:18 [crit] 28214#28214: *1345 connect() to unix:/var/lib/php7.0-fpm/web4.sock failed (2: No such file or directory) while connecting to upstream, client: 66.249.75.153, server: dantesinfernophotography.com, request: "GET /photos/index.php?/categories/flat/start-315&mobile=false&mobile=true HTTP/1.1", upstream: "fastcgi://unix:/var/lib/php7.0-fpm/web4.sock:", host: "www.dantesinfernophotography.com"
    2018/11/30 14:35:35 [crit] 28214#28214: *1348 connect() to unix:/var/lib/php7.0-fpm/web4.sock failed (2: No such file or directory) while connecting to upstream, client: 192.0.91.177, server: dantesinfernophotography.com, request: "HEAD /blog/ HTTP/1.1", upstream: "fastcgi://unix:/var/lib/php7.0-fpm/web4.sock:", host: "www.dantesinfernophotography.com"
    2018/11/30 14:39:39 [crit] 28214#28214: *1353 connect() to unix:/var/lib/php7.0-fpm/web4.sock failed (2: No such file or directory) while connecting to upstream, client: 99.78.112.49, server: dantesinfernophotography.com, request: "GET /photos/index.php HTTP/1.1", upstream: "fastcgi://unix:/var/lib/php7.0-fpm/web4.sock:", host: "www.dantesinfernophotography.com"
    2018/11/30 14:40:06 [crit] 28214#28214: *1356 connect() to unix:/var/lib/php7.0-fpm/web4.sock failed (2: No such file or directory) while connecting to upstream, client: 66.249.75.151, server: dantesinfernophotography.com, request: "GET /photos/picture.php?/195/categories&mobile=false&mobile=true HTTP/1.1", upstream: "fastcgi://unix:/var/lib/php7.0-fpm/web4.sock:", host: "www.dantesinfernophotography.com"
    2018/11/30 14:41:04 [crit] 28214#28214: *1359 connect() to unix:/var/lib/php7.0-fpm/web4.sock failed (2: No such file or directory) while connecting to upstream, client: 192.0.91.177, server: dantesinfernophotography.com, request: "HEAD /blog/ HTTP/1.1", upstream: "fastcgi://unix:/var/lib/php7.0-fpm/web4.sock:", host: "www.dantesinfernophotography.com"
    
     
  2. till

    till Super Moderator Staff Member ISPConfig Developer

    Does the directory
    /var/lib/php7.0-fpm/ exist and does it contain any .sock files? Did you try to restart php7.0-fpm and does that fix the issue or do you get an error when you restart the php fpm daemon?
     
  3. DantePasquale

    DantePasquale Member HowtoForge Supporter

    php7-fpm was masked? Whatever that means, so I un-masked it and restarted it. But still get the 502 errors:
    Code:
    systemctl status php7.0-fpm
    ● php7.0-fpm.service - LSB: starts php7.0-fpm
       Loaded: loaded (/etc/init.d/php7.0-fpm; generated)
       Active: active (exited) since Sat 2018-12-01 13:29:48 EST; 2min 7s ago
         Docs: man:systemd-sysv-generator(8)
      Process: 10593 ExecStart=/etc/init.d/php7.0-fpm start (code=exited, status=0/SUCCESS)
    
    Dec 01 13:29:48 inferno.cocoanet.us systemd[1]: Starting LSB: starts php7.0-fpm...
    Dec 01 13:29:48 inferno.cocoanet.us systemd[1]: Started LSB: starts php7.0-fpm.
    
    Code:
    systemctl status nginx.service
    ● nginx.service - A high performance web server and a reverse proxy server
       Loaded: loaded (/lib/systemd/system/nginx.service; enabled; vendor preset: enabled)
       Active: active (running) since Sat 2018-12-01 13:32:13 EST; 1min 29s ago
         Docs: man:nginx(8)
      Process: 10843 ExecStop=/sbin/start-stop-daemon --quiet --stop --retry QUIT/5 --pidfile /run/nginx.pid (code=exited, status=0/SUCCESS)
      Process: 10845 ExecStart=/usr/sbin/nginx -g daemon on; master_process on; (code=exited, status=0/SUCCESS)
      Process: 10844 ExecStartPre=/usr/sbin/nginx -t -q -g daemon on; master_process on; (code=exited, status=0/SUCCESS)
     Main PID: 10846 (nginx)
        Tasks: 9 (limit: 4915)
       CGroup: /system.slice/nginx.service
               ├─10846 nginx: master process /usr/sbin/nginx -g daemon on; master_process on;
               ├─10847 nginx: worker process
               ├─10848 nginx: worker process
               ├─10849 nginx: worker process
               ├─10850 nginx: worker process
               ├─10851 nginx: worker process
               ├─10852 nginx: worker process
               ├─10853 nginx: worker process
               └─10854 nginx: worker process
    
    Dec 01 13:32:12 inferno.cocoanet.us systemd[1]: Starting A high performance web server and a reverse proxy server...
    Dec 01 13:32:13 inferno.cocoanet.us systemd[1]: Started A high performance web server and a reverse proxy server.
    
     
  4. till

    till Super Moderator Staff Member ISPConfig Developer

    Does the directory /var/lib/php7.0-fpm/ exist and does it contain any .sock files now?
     
  5. DantePasquale

    DantePasquale Member HowtoForge Supporter

    The directory /var/lib/php7-fpm/ DOES exist. However the directory is empty
    Code:
    root@inferno:/var/lib/php7.0-fpm# ls -la
    total 8
    drwx------   2 www-data www-data 4096 Nov 29 14:51 .
    drwxr-xr-x 115 root     root     4096 Nov 30 00:14 ..
    
     
  6. Taleman

    Taleman Well-Known Member HowtoForge Supporter

    On my host owner and permissions are different:
    CODE]root@web:/var/log/apache2# ls -lha /var/lib/php7.0-fpm/
    yhteensä 8,0K
    drwxr-xr-x 2 root root 4,0K marra 21 10:27 .
    drwxr-xr-x 44 root root 4,0K marra 14 16:25 ..
    srw-rw---- 1 web80 www-data 0 marra 21 10:27 web80.sock
    [/CODE]
     
  7. DantePasquale

    DantePasquale Member HowtoForge Supporter

    what does the parent look like?
    Code:
    root@inferno:/var/lib# ls -l | grep php7.0
    drwx------  2 www-data      www-data        4096 Nov 29 14:51 php7.0-fpm
    
     
  8. Taleman

    Taleman Well-Known Member HowtoForge Supporter

    It looks like this:
    I copied that from my previous post.
     
  9. DantePasquale

    DantePasquale Member HowtoForge Supporter

    ok, I fixed the owners and permissions.

    Still no .sock file

    Do I need to create that file manually?
     
  10. till

    till Super Moderator Staff Member ISPConfig Developer

    No, it gets created by php when you start php fpm. Do you have a file
    /var/lib/php7.2-fpm/web4.sock ?
     
  11. DantePasquale

    DantePasquale Member HowtoForge Supporter

    no, that directory is still empty -- should I re-install php7-fpm?
     
  12. DantePasquale

    DantePasquale Member HowtoForge Supporter

    Ok, so maybe it's better to change the websites to php7.2-fpm but what would the syntax be? Also I'm running nginx
    Code:
    ./sites-enabled/100-dantesinfernophotography.com.vhost:            fastcgi_pass unix:/var/lib/php7.0-fpm/web4.sock;
    ./sites-enabled/100-dantesinfernophotography.com.vhost:                               fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;
    
     
  13. till

    till Super Moderator Staff Member ISPConfig Developer

    Check that the PHP settings under system > Server config contain the correct settings for php 7.2. Then go to the website, select 'Default' as php version and press save. If Default is already the selected php version, then select another version, press save, edit the site settings again and select default and then save again.
     
  14. florian030

    florian030 Well-Known Member HowtoForge Supporter

    and make sure, that all packages for ubuntu18 are installed (see the perfect setup for ubuntu18)
     
  15. DantePasquale

    DantePasquale Member HowtoForge Supporter

    Will do, but I can't get the ISPConfig Control Panel to come up as that gets the 502 error too :(
    I'll revisit the perfect setup, Since this is a test system, maybe I wasn't following it carefully
    Thanks for the suggestions!

    OK Looks like some unrelated packages were missed and those are now fixed.
    Here's what I see now:
    Code:
    
    dpkg-reconfigure php7.0-fpm
    /usr/sbin/dpkg-reconfigure: php7.0-fpm is broken or not fully installed
    
    apt-get install php7.0-fpm
    Reading package lists... Done
    Building dependency tree      
    Reading state information... Done
    Package php7.0-fpm is not available, but is referred to by another package.
    This may mean that the package is missing, has been obsoleted, or
    is only available from another source
    
    E: Package 'php7.0-fpm' has no installation candidate
    
    So, how do I install php7.0-fpm safely???

    I've seen instructions to add some PPA but I'm not sure that's the best way to do this :(
     
    Last edited: Dec 11, 2018
  16. Taleman

    Taleman Well-Known Member HowtoForge Supporter

    According to https://packages.ubuntu.com/search?keywords=php7.0-fpm&searchon=names&suite=bionic&section=all
    Ubuntu 18.04 does not have php7.0-fpm (and other PHP 7.0 packages). Maybe a leftover if you upgraded from older ubuntu to 18.04? My understanding is on Ubuntu 18.04 ISPConfig panel need the default PHP, that is PHP 7.2.
    If you want more PHP versions available, there is tutorial: https://www.howtoforge.com/tutorial/how-to-install-php-7-for-ispconfig-3-from-debian-packages-on-debian-8-and-9/ Read Read also comments, expecially the one by Jesse Norell.
    But I believe those extra versions can not be used with ISPConfig panel, but the websites.
     
  17. DantePasquale

    DantePasquale Member HowtoForge Supporter

    Ok well that makes perfect sense but what do I need to change in the nginx config for the ISPConfig CP to point to php 7.2?
    I'm not seeing the equivalent of the /var/lib/php7.0-fpm/ispconfig.sock entry
    Code:
    grep php 000-ispconfig.vhost 
                   index index.php index.html;
            location ~ \.php$ {
                   fastcgi_pass unix:/var/lib/php7.0-fpm/ispconfig.sock;
                   fastcgi_index index.php;
    
    Code:
    php -v
    PHP 7.2.10-0ubuntu0.18.04.1 (cli) (built: Sep 13 2018 13:45:02) ( NTS )
    Copyright (c) 1997-2018 The PHP Group
    Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies
        with Zend OPcache v7.2.10-0ubuntu0.18.04.1, Copyright (c) 1999-2018, by Zend Technologies
    
    
     
  18. Taleman

    Taleman Well-Known Member HowtoForge Supporter

    I do not know about nginx. But with apache, ISPConfig creates that vhost itself. Is that file you now have something you have written yourself?
     
  19. DantePasquale

    DantePasquale Member HowtoForge Supporter

    I copied those files over from the prod servers, so I probably wiped out the one that was created? Shoot .... any idea on how to recreate it?
     
  20. till

    till Super Moderator Staff Member ISPConfig Developer

    Vhost files can be recreated with Tools > resync from within ISPConfig and the ispconfig vhost gets recreated when you update ispconfig and choose to reconfigure services during update.
     

Share This Page