Control panel gives 502 Bad gateway after upgrading from Debian 8 to Debian 9

Discussion in 'Installation/Configuration' started by fbarcenas, Dec 13, 2019.

  1. fbarcenas

    fbarcenas Member

    Php seems ok as in running:
    Code:
    [ ok ] Starting php7.0-fpm (via systemctl): php7.0-fpm.service.
    ispconfig.vhost in /etc/nginx/sites-available looks normal:

    Code:
    server {
            listen 8080 ssl;
            listen [::]:8080 ssl ipv6only=on;
    
                    ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
            ssl_certificate /usr/local/ispconfig/interface/ssl/ispserver.crt;
            ssl_certificate_key /usr/local/ispconfig/interface/ssl/ispserver.key;
            ssl_ciphers 'ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:DHE-RSA-AES128$
            ssl_prefer_server_ciphers on;
    
                    # redirect to https if accessed with http
                    error_page 497 https://$host:8080$request_uri;
    
            server_name _;
    
            root   /usr/local/ispconfig/interface/web/;
    
            client_max_body_size 20M;
    
            location / {
                   index index.php index.html;
            }
    
            # serve static files directly
            location ~* ^.+\.(jpg|jpeg|gif|css|png|js|ico|html|xml|txt)$ {
                   access_log        off;
            }
    
            location ~ \.php$ {
                   try_files $uri =404;
                   include /etc/nginx/fastcgi_params;
                   fastcgi_pass unix:/var/lib/php7.0-fpm/ispconfig.sock;
                   fastcgi_index index.php;
                   fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
                   #fastcgi_param PATH_INFO $fastcgi_script_name;
                   fastcgi_buffer_size 128k;
                   fastcgi_buffers 256 4k;
                   fastcgi_busy_buffers_size 256k;
                   fastcgi_temp_file_write_size 256k;
                   fastcgi_read_timeout 1200;
                               fastcgi_param HTTP_PROXY "";
            }
    
            location ~ /\. {
                   deny  all;
            }
    }
    log shows:
    Code:
    2019/12/13 11:36:14 [crit] 1845#1845: *1301 connect() to unix:/var/lib/php7.0-fpm/ispconfig.sock failed (13: Permission denied) while connecting to upstream, client: 96.44.94.99, server: _, request: "GET / HTTP/1.1", upstream: "fastcgi://unix:/var/lib/php7.0-fpm/ispconfig.sock:", host: "cp.xxx.com:8080"
     
    Last edited: Dec 13, 2019
  2. Steini86

    Steini86 Active Member

    Only control panel, or all pages?
    Does this file exist? /var/lib/php7.0-fpm/ispconfig.sock
    What is in the nginx error log?
    Have you restarted the server after the upgrade?
     
  3. fbarcenas

    fbarcenas Member

    only on Control panel
    yes it exists
    Same as above
    yes, no change.
     
  4. fbarcenas

    fbarcenas Member

    Permissions:
    /usr/local/ispconfig
    Code:
    drwxr-x---  9 ispconfig ispconfig 4096 Dec 30  2016 interface
    drwxr-s---  3 root      ispconfig 4096 Mar 19  2018 security
    drwxr-x--- 13 root      root      4096 Dec 13 05:02 server
    
     
    Last edited: Dec 13, 2019
  5. Steini86

    Steini86 Active Member

    Sry, haven't seen the edit.
    Looks like nginx can't access the sock file. What gives?
    Code:
    ls -al /var/lib/php7.0-fpm/ispconfig.sock
    What are (in comparison) the permissions of a web that works?
     
  6. fbarcenas

    fbarcenas Member

    Code:
    srwxrwxrwx 1 ispconfig ispconfig 0 Dec 13 14:51 /var/lib/php7.0-fpm/ispconfig.sock
    
    The ones that work aren't using sockets they are using IP:pORT like this:
    Code:
    fastcgi_pass 127.0.0.1:9107;
     
  7. Steini86

    Steini86 Active Member

    As which user is nginx running? does that user have permissions to read the folder /var/lib/php7.0-fpm?
    Try
    Code:
    chown www-data:www-data /var/lib/php7.0-fpm
    systemctl restart nginx
     
    fbarcenas likes this.
  8. fbarcenas

    fbarcenas Member

    yeah!!! that fixed it!!!
     
    Steini86 likes this.

Share This Page