參考網址:
https://www.howtoforge.com/the-perfect-server-ubuntu-14.04-nginx-bind-mysql-php-postfix-dovecot-and-ispconfig3-p3
透過上述參考網址安裝 ubuntu 14.04LTS + ispconifg3 + nginx + php 後,根據文中說明,可以使用 http://domain:8081/phpmyadmin 存取 phpmyadmin 介面,但是一直發生 502 Bad Getaway的錯誤。
使用指令
tail /var/log/nginx/error.log
後發現錯誤如下:
connect() to unix:/var/run/php5-fpm.sock failed (2: No such file or directory) while connecting to upstream
發現是 /var/run/php5-fpm.sock這個檔案不存在造成的,網路上建議修改方式為
1. 修改
/etc/php5/fpm/pool.d/www.conf 內
listen = /var/run/php5-fpm.sock
變成
listen = 127.0.0.1:9000
參考網址:
https://wildlyinaccurate.com/solving-502-bad-gateway-with-nginx-php-fpm/
修改過後還是無法存取 phpmyadmin,錯誤訊息依舊是
connect() to unix:/var/run/php5-fpm.sock failed (2: No such file or directory) while connecting to upstream
於是檢查 nginx 的設定發現,在 /etc/nginx/sites-available/apps.vhost 中定義了 phpmyadmin 的相關資訊,在 location /phpmyadmin 中發現
fastcgi_pass unix:/var/run/php5-fpm.sock;
將上述定義改成
fastcgi_pass 127.0.0.1:9000;
並重啟 server
sudo service nginx restart
問題解決!!!
如果在log中看到
[error] 5435#0: *2 FastCGI sent in stderr: "PHP message: PHP Warning: require_once(/usr/local/ispconfig/interface/lib/config.inc.php): failed to open stream: Permission denied in /usr/local/ispconfig/interface/web/index.php on line 31
請執行以下指令修改權限
chmod 660 /usr/local/ispconfig/interface/lib/config.inc.php