2012-05-18 91 views
0

我正面臨一個獨特的問題。我已經安裝的Apache 2.4.1及以下是我的配置:「Hello World」的Apache 2.4.1配置

ServerRoot "prakash_prasad/bin" 
AddHandler cgi-script .py 
ScriptAlias /~prakash_prasad/ "/x/home/prakash_prasad/public_html/" 
ScriptAlias /test/ "/x/test/prakash_prasad/public_html/" 
DocumentRoot "/mybox/prakash_prasad/bin/htdocs" 
<Directory "/x/test/*/public_html/"> 
    Options +ExecCGI 
    Options ExecCGI 
    Order allow,deny 
    Allow from all 
    Options All 
    SetHandler cgi-script 
    AddHandler cgi-script .py 
    AllowOverride None 
    Require all granted 
    AddHandler cgi-script .py 
    SetHandler cgi-script 
    AllowOverride None 
    Require all granted 
    Options ExecCGI 
    Order allow,deny 
    Allow from all 
    Options All 
    SetHandler cgi-script 
    AddHandler cgi-script .py 
    AllowOverride None 
    Require all granted 
</Directory> 

<Directory "/x/home/prakash_prasad/public_html/*"> 
    Options +ExecCGI 
    Options ExecCGI 
    Order allow,deny 
    Allow from all 
    Options All 
    SetHandler cgi-script 
    AddHandler cgi-script .py 
    AllowOverride None 
    Require all granted 
    AddHandler cgi-script .py 
    SetHandler cgi-script 
    AllowOverride None 
    Require all granted 
</Directory> 

現在我有一個樣品「first.py」傾銷程序當我在瀏覽器中輸入以下網址的正常工作

的http:// IP /測試/ first.py

但是當我嘗試加載HTML頁面:

HTTP:// IP /測試/ index.html的

我得到以下錯誤的瀏覽器:

內部服務器錯誤

服務器遇到內部錯誤或配置錯誤,無法完成您的請求。

請通過[email protected]與服務器管理員聯繫,告知他們發生此錯誤的時間以及您在此錯誤出現之前執行的操作。

有關此錯誤的更多信息可能在服務器錯誤日誌中可用。

,同時在日誌中我看到:

[Thu May 17 23:07:10.664648 2012] [cgid:error] [pid 10386:tid 47977877412864] (13)Permission denied: AH01241: exec of '/x/test/prakash_prasad/public_html/index.html' failed 
[Thu May 17 23:07:10.665034 2012] [cgid:error] [pid 9849:tid 1232931136] [client 10.239.40.209:54712] End of script output before headers: index.html 

請讓我知道我需要糾正一下配置?

::最新通報::

我縮小到一個點,但不知道這個問題可能是:

當我發表意見cgid進行模塊解決了我的問題:

# LoadModule cgid_module modules/mod_cgid.so 

我的HTML頁面很好,但不是我的Python腳本

雖然我取消註釋

LoadModule cgid_module modules/mod_cgid.so 

我的腳本工作正常,但HTML文件給出錯誤。

任何想法可能是什麼問題?

回答

0

嘗試在你的配置中刪除重複的指令,因爲這些可能會造成一個問題,即第一個目錄:

<Directory "/x/test/*/public_html/"> 
    Options +ExecCGI 
    Options ExecCGI 
    Order allow,deny 
    Allow from all 
    Options All 
    SetHandler cgi-script 
    AddHandler cgi-script .py 
    AllowOverride None 
    Require all granted 
</Directory> 
+0

我太累了,但是我發現一個問題,我縮小到一個點,但不知道這個問題可能是:當我評論cgid模塊#LoadModule cgid_module modules/mod_cgid.so我的HTML頁面很好,但不是我的Python腳本,而我取消註釋它LoadModule cgid_module modules/mod_cgid.so我的腳本工作正常,但HTML文件給出錯誤。任何想法可能是什麼問題? – Prakash

2

隨着「選項+ ExecCGI」指令Web服務器將把public_html下的所有文件作爲一個可執行文件。所以,你有你的opython文件放到一個單獨的目錄

ScriptAlias /pyfiles/ /home/x/public_html/pyfiles/

然後把你的HTMLS /home/x/public_html/