[英]error when installing mod_wsgi for python 2.7
我已經從源代碼安裝了mod_wsgi以使用python2.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?
如果那是您的整個配置文件,則您從未告訴過Apache加載模塊。
這就是為什么錯誤消息顯示“無效的命令'WSGIScriptAlias',可能是服務器配置中未包含的模塊拼寫錯誤或定義的 ”。
有關參考,請參見LoadModule
以獲取參考, DSO支持以獲取簡介,以及Apache隨附的示例配置。
如上面的@abarnert所述,我沒有將行添加到apache config的modules部分。 添加即解決了該問題。 當您從源代碼(而不是yum安裝)添加mod_wsgi時,顯然不會自動添加該代碼。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.