我已经从源代码安装了 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 support以获取介绍,并以 Apache 附带的示例配置为例。
关于python - 为 python 2.7 安装 mod_wsgi 时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26267802/