【问题标题】:Django with mod_wsgi-express and Apache displays Apache test page instead of site home page带有 mod_wsgi-express 和 Apache 的 Django 显示 Apache 测试页面而不是站点主页
【发布时间】:2016-03-06 07:30:00
【问题描述】:

我正在尝试在 CentOS 6.7 Linux PaaS 服务器 VM 上设置基于 Django 的网站。

我已经在 virtualenv 中安装了 Python 2.7.8。

我正在使用 Apache 2.2.15(使用 yum 安装)、Django 1.7(使用 pip2.7 安装)和 mod_wsgi-express 版本 4.4.21(我从源代码编译)。

我已按照https://pypi.python.org/pypi/mod_wsgi 的说明进行操作 并且在 Django 项目根目录下发出的这个命令对我有用:

(vishwaas_env)$sudo python manage.py runmodwsgi  --host=0.0.0.0 --port=80 --user apache --group apache --server-root=/home/syt_admin/projects/vishwaas/www

我可以将浏览器指向 VM 的公共 IP 地址并连接到我的站点。位于我的服务器根目录中的 error_log 显示正常运行:

[Thu Dec 03 10:48:22 2015] [notice] Apache/2.2.15 (Unix) mod_wsgi/4.4.21 Python/2.7.8 configured -- resuming normal operations

但是,由于我想将此作为后台任务开始,因此我遵循了 Graham 对这个问题的回答:

how can run django on centos using wsgi

我已经设置了服务器配置:

(vishwaas_env)$ python manage.py runmodwsgi --setup-only --host=0.0.0.0 --port=80 --user apache --group apache --server-root=/home/syt_admin/projects/vishwaas/www

并在服务器根目录中启动 apachectl 脚本

(vishwaas_env)$ sudo apachectl start

但这一次,将浏览器指向相同的 IP 地址会显示 Apache 2 测试页面。此外,这一次,包含消息的 error_log 位于 /var/log/httpd/error_log

[Thu Dec 03 10:50:52 2015] [notice] suEXEC mechanism enabled (wrapper:   /usr/sbin/suexec)
[Thu Dec 03 10:50:52 2015] [notice] Digest: generating secret for digest authentication ...
[Thu Dec 03 10:50:52 2015] [notice] Digest: done
[Thu Dec 03 10:50:52 2015] [notice] Apache/2.2.15 (Unix) DAV/2 configured -- resuming normal operations
[Thu Dec 03 10:51:03 2015] [error] [client <ip address>] Directory index forbidden by Options directive: /var/www/html/

我错过了什么?

【问题讨论】:

    标签: django apache mod-wsgi


    【解决方案1】:

    刚刚意识到我的错误。

    $sudo apachectl 启动

    在 /usr/sbin/apachectl 执行脚本

    而不是我本地目录中的那个。

    $sudo ./apachectl start

    调用了具有正确配置的那个。我需要弄清楚我的路径定义中缺少什么。

    【讨论】:

      猜你喜欢
      • 2014-11-28
      • 1970-01-01
      • 2019-08-10
      • 2018-12-05
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-09-12
      • 2014-05-10
      相关资源
      最近更新 更多