Apache-2.2

Virtualmin 全新安裝 - PHP 的內部伺服器錯誤

  • March 8, 2015

我剛剛重新安裝了伺服器的作業系統(Ubuntu 10.04 LTS)並使用安裝腳本(install.sh)安裝了 Virtualmin。伺服器上的一切都完全是普通的——登錄到干淨的系統後我唯一做的就是執行 install.sh 並啟用 userdir Apache 模組。

我創建了一個虛擬主機並使用 SFTP 登錄到它的帳戶,然後創建了一個包含 phpinfo() 的 php 文件。當我瀏覽到該文件時,我收到 500 內部伺服器錯誤。Virtualmin 的預設設置使用 fcgid 來執行 PHP。

Apache 的 error.log 顯示了這一點:

[Fri Jan 27 10:20:46 2012] [notice] mod_fcgid: call /home/username/public_html/info.php with wrapper /home/username/fcgi-bin/php5.fcgi
suexec policy violation: see suexec log for more details
[Fri Jan 27 10:20:52 2012] [notice] mod_fcgid: process /home/username/public_html/info.php(28890) exit(communication error), terminated by calling exit(), return code: 112

和 suexec.log 有這個:

[2012-01-27 10:20:46]: uid: (1000/username) gid: (1000/username) cmd: php5.fcgi
[2012-01-27 10:20:46]: cannot get docroot information (/home/username)

並且虛擬主機的 error_log 有這個:

[Fri Jan 27 11:07:02 2012] [warn] [client 1.2.3.4] (104)Connection reset by peer: mod_fcgid: error reading data from FastCGI server
[Fri Jan 27 11:07:02 2012] [error] [client 1.2.3.4] Premature end of script headers: info.php

顯然問題出在 suexec 上,但我已經在這台伺服器上玩了幾天,試圖讓配置正確(但收效甚微),這次我要在我接觸任何東西之前尋求幫助,並可能使更糟:)

任何幫助將非常感激 :)

請檢查是否安裝了 apache2-suexec-custom 模組。另外,請檢查 /etc/apache2/suexec/www-data 文件的內容:

/home
public_html/cgi-bin
# The first two lines contain the suexec document root and the suexec userdir
# suffix. If one of them is disabled by prepending a # character, suexec will
# refuse the corresponding type of request.
# This config file is only used by the apache2-suexec-custom package. See the
# suexec man page included in the package for more details.

我想您將站點託管在 /home 目錄中?如果沒有,您將需要調整配置。

引用自:https://serverfault.com/questions/354272