1

Apache 无法使用 mod_wsgi 启动 Django WEB 应用程序,我无法弄清楚原因。

apache启动的错误是这样的

linux-ua6r:/etc/apache2/vhosts.d # /etc/init.d/apache2 start
redirecting to systemctl  start apache2
Job for apache2.service failed. See 'systemctl status apache2.service' and 'journalctl -n' for details.
linux-ua6r:/etc/apache2/vhosts.d # systemctl status apache2.service
apache2.service - apache
          Loaded: loaded (/lib/systemd/system/apache2.service; enabled)
          Active: failed (Result: exit-code) since Tue, 2013-05-28 04:13:12 PDT; 15s ago
         Process: 8953 ExecStop=/usr/sbin/httpd2 -D SYSTEMD -k stop (code=exited, status=0/SUCCESS)
         Process: 8991 ExecStart=/usr/sbin/start_apache2 -D SYSTEMD -k start (code=exited, status=1/FAILURE)
        Main PID: 8918 (code=exited, status=0/SUCCESS)
          CGroup: name=systemd:/system/apache2.service

May 28 04:13:12 linux-ua6r.site systemd[1]: Failed to start apache.
May 28 04:13:12 linux-ua6r.site systemd[1]: Unit apache2.service entered failed state

如果我删除我的 vhosts.conf 文件,它会在没有此错误的情况下启动。. . vhosts conf文件本身有以下内容

<VirtualHost *:80>
        ServerAdmin j@j.com
        ServerName www.Services.pes.com
        ErrorLog server-logs/pes_error_log
        CustomLog server-logs/pes_access_log common

        WSGIScriptAlias /pes "/root/pweb/django.wsgi"

        <Directory "/root/pweb/">
        Order deny,allow
        Allow from all
        </Directory>
</VirtualHost>

感谢有人可以提供帮助。

4

1 回答 1

1

问题似乎是以下行(要么将其注释掉,要么确保 mod_wsgi 已加载并正常工作或使用别名指令)

WSGIScriptAlias /pes "/root/pweb/django.wsgi"

要使用 alias 指令,请使用以下指令,但请注意,您可能希望 mod_wsgi 工作。

Alias /pes "/root/pweb/django.wsgi"

要查看是否加载了 mod_wsgi,请尝试此操作并查找模块名称:

sudo /usr/sbin/apache2ctl -M

背景:您还需要验证目标目录/文件是否存在及其健康状况 ll /root/pweb/django.wsgi

于 2013-05-28T18:40:40.887 回答