2014-10-08 376 views
0

安裝mod_wsgi的時候我已經安裝了從源頭的mod_wsgi使用python2.7這樣的:錯誤蟒蛇2.7

git clone https://github.com/GrahamDumpleton/mod_wsgi.git 
./configure --with-python=/usr/bin/python2.7 
make 
make install 

當我試着啓動Apache,我得到的錯誤:

Starting httpd: Syntax error on line 1020 of /etc/httpd/conf/httpd.conf: 
Invalid command 'WSGIScriptAlias', perhaps misspelled or defined by a module not included in the server configuration 
                  [FAILED] 

我的httpd.conf如下所示:

Alias /static/ /var/www/html/django/shared/static/ 

<Directory /var/www/html/django/shared/static/> 
Order deny,allow 
Allow from all 
</Directory> 


WSGIScriptAlias//var/www/html/django/wsgi.py 
WSGIPythonPath /var/www/html/django 

<Directory /var/www/html/django> 
<Files wsgi.py> 
Order deny,allow 
Allow from all 
</Files> 
</Directory> 

爲什麼apache沒有找到mod_wsgi?

+1

你實際上是否告訴Apache加載模塊? – abarnert 2014-10-08 23:16:28

+0

@abarnert你知道我是怎麼做到的? – Atma 2014-10-08 23:41:41

回答

0

正如上面提到的@abarnert,我並沒有將該行添加到apache配置的模塊部分。添加解決了這個問題。當你從源代碼添加mod_wsgi而不是yum安裝時,這顯然不會自動添加。

1

如果這是您的整個配置文件,您從未告訴Apache加載模塊。

這就是爲什麼錯誤消息顯示「無效命令'WSGIScriptAlias',可能拼寫錯誤或由未包含在服務器配置中的模塊定義」。

請參閱LoadModule作爲參考,DSO support作爲介紹,以及示例配置Apache附帶的示例。

+0

你有什麼mod_wsgi模塊被調用,以便我可以加載它在Apache? – Atma 2014-10-08 23:41:11

+0

@ Atma:它是[在文檔](https://code.google.com/p/modwsgi/wiki/QuickInstallationGuide#Loading_Module_Into_Apache)。 – abarnert 2014-10-09 00:28:01