今天網站突然出現如下錯誤:
The page you are looking for is temporarily unavailable.Please try again later.
很奇怪,我對伺服器端的技術不是很熟悉,於是查詢了下google,在https://wiki.archlinux.org/index.php/Nginx
上面的解決方案:
Error: The page you are looking for is temporarily unavailable. Please try again later.
This is because the FastCGI server has not been started.
如何解決呢?
剛開始我懷疑是不是nginx掛了,我首先通過ps aux | grep nginx,結果出現:
root 3769 0.0 0.0 5760 692 ? Ss Apr21 0:00 nginx: master process /usr/local/nginx/sbin/nginx
www 3770 0.0 0.1 18680 14252 ? S Apr21 0:03 nginx: worker process
www 3771 0.0 0.1 18680 14252 ? S Apr21 0:03 nginx: worker process
www 3772 0.0 0.1 18712 14276 ? S Apr21 0:03 nginx: worker process
www 3774 0.0 0.1 18680 14248 ? S Apr21 0:03 nginx: worker process
www 3776 0.0 0.1 18712 14240 ? S Apr21 0:03 nginx: worker process
www 3777 0.0 0.1 18680 14252 ? S Apr21 0:03 nginx: worker process
www 3778 0.0 0.1 18680 14232 ? S Apr21 0:02 nginx: worker process
root 24068 0.0 0.0 5196 756 pts/1 S+ 14:33 0:00 grep nginx
可見nginx是正常的,本來打算重啟nginx的:
/usr/local/nginx/sbin/nginx -t -c /usr/local/nginx/conf/nginx.conf的,
突然覺得有沒有其他方法,有同事提示先在一個目錄下運行下test.html和test.php,結果html可以運行,php無法運行。
證實是php沒有啟動,我剛才也檢測過php的進程,的確是沒有php進程,這台伺服器我不熟悉,同事幫忙查看了下
cd /etc/init.d,就是web管理員經常看的地方,是隨著系統自動啟動的服務,程式等。可以看看:
http://blog.wgzhao.com/2008/12/27/talk-about-rc-local.html的《說說?/etc/rc.d/rc.local》
找到:
/usr/local/php/sbin/php-fpm start,首先什麼是php-fpm呢?
就是FastCGI Process Manager,是一種可選的PHP FastGCI執行模式,有一點很有特點的應用,尤其是一個繁忙的網站中:
(1)可適應的進行再生(NEW!)
(2)基本的統計功能(Apache's mod_status)
(3)進階進程管理功能,能夠優雅的停止/開始
(4)能夠使用不同的工作使用者和不同的php.ini
(5)輸入,輸出日誌記錄...
開啟後,一切恢複正常!自己的伺服器端技術還是有很多地方使用的不夠。需要多學習使用!