我试图在CentOS 6.7 Linux PaaS服务器虚拟机上设置基于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
然而,由于我想将此作为后台任务开始,我遵循格雷厄姆对这个问题的回答:
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
并在server-root目录中启动了apachectl脚本
(vishwaas_env)$ sudo apachectl start
但这一次,将浏览器指向相同的IP地址会显示Apache 2 Test页面。此外,这次包含消息的error_log是 在/ var /日志/ 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/
我错过了什么?
答案 0 :(得分:0)
刚刚意识到我的错误。
$ sudo apachectl start
正在/ usr / sbin / apachectl
执行脚本而不是我本地目录中的那个。
$ sudo ./apachectl start
使用正确的配置调用了一个。我需要弄清楚路径定义中缺少的内容。