python - 为 python 2.7 安装 mod_wsgi 时出错

标签 python linux apache python-2.7 mod-wsgi

我已经从源代码安装了 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/

相关文章:

linux - ping, ssh, ... 使用的 IP 与 nslookup、host 解析的 IP 不同,

linux - 创建 .deb 文件时出现权限问题

linux - 参数未传递给 shell 脚本 copyfile.sh : 1: copyfile. sh: [d: 未找到

security - 使用 url 中的用户名/密码的 Apache 基本身份验证

xml - XSLT-FO for 每个

python - 在 Python 中打开套接字的最佳方法

python 3 : How to move an item from list x to list y and remove it from list x?

python - Flask_simpleldap 不会绑定(bind)

python - 避免可变性错误的传统(且有效)方法是什么?

python - 关于网站停机更新的问题