【问题标题】:error when installing mod_wsgi for python 2.7为 python 2.7 安装 mod_wsgi 时出错
【发布时间】:2014-12-03 18:09:58
【问题描述】:

我已经从源代码安装了 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 加载模块吗?
  • @abarnert 你知道我是怎么做到的吗?

标签: python linux apache python-2.7 mod-wsgi


【解决方案1】:

如果这是你的整个配置文件,你从来没有告诉 Apache 加载模块。

这就是错误消息显示“无效命令 'WSGIScriptAlias',可能拼写错误或由未包含在服务器配置中的模块定义”的原因。

请参阅LoadModule 以获取参考,DSO support 以获取介绍,以及 Apache 附带的示例配置以获取示例。

【讨论】:

  • 你知道 mod_wsgi 模块叫什么,以便我可以在 apache 中加载它吗?
  • @Atma:我是in the docs
【解决方案2】:

正如上面提到的@abarnert,我没有将这一行添加到 apache 配置的模块部分。添加解决了这个问题。当您从源代码添加 mod_wsgi 而不是 yum 安装时,这显然不会自动添加。

【讨论】:

    猜你喜欢
    • 2012-09-02
    • 2012-01-04
    • 1970-01-01
    • 2011-07-24
    • 1970-01-01
    • 2014-05-04
    • 1970-01-01
    • 1970-01-01
    • 2012-11-15
    相关资源
    最近更新 更多