apps_vhost_plugin.inc.php refers to hard coded php version causing 502 errors
symptom (not the root cause)
/etc/nginx/sites-available/apps.vhost is using tcp (
fastcgi_pass 127.0.0.1:9000;) for locations phpmyadmin and squirrelmail. This causes the 502 error.
changing both locations to use socket (
fastcgi_pass unix:/var/lib/php7.1-fpm/apps.sock;) resolves the issue.
However, /etc/nginx/sites-available/apps.vhost is overwritten by /usr/local/ispconfig/server/plugins-available/apps_vhost_plugin.inc.php using the template /usr/local/ispconfig/server/conf/nginx_apps.vhost.master after a reboot. Thus, the issue surfaces again afterwards.
problem (root cause)
apps_vhost_plugin.inc.php refers to hard coded php version in line 172:
if(file_exists('/var/run/php5-fpm.sock') || file_exists('/var/run/php/php7.0-fpm.sock')
Since used version of php is 7.1, produced apps.vhost contains the tcp version of the statement:
Testing for /var/run/php/php7.1-fpm.sock would have produced the socket version
apps_vhost_plugin.inc.php line 172 if condition must be modified to seek for the file with a dynamic php version (I do not know how)
Server OS: ubuntu Server OS version: 17.10 ISPConfig version: 3.1dev Nginx:
nginx version: nginx/1.12.1 (Ubuntu)
PHP 7.1.15-0ubuntu0.17.10.1 (cli) (built: Mar 14 2018 22:30:42) ( NTS ) Copyright (c) 1997-2018 The PHP Group Zend Engine v3.1.0, Copyright (c) 1998-2018 Zend Technologies with Zend OPcache v7.1.15-0ubuntu0.17.10.1, Copyright (c) 1999-2018, by Zend Technologies
#2373 (closed) reports the same problem. But the issue is closed as fixed.
[error] 1043#1043: *87 connect() failed (111: Connection refused) while connecting to upstream, client: <ip>, server: _, request: "GET /phpmyadmin/ HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "<ip>:8081"