Django,Apache2返回默认的工作页面

问题描述 投票:0回答:1

我试图通过apache2网络服务器的LetsEncrypt certbot在Django网站上启用ssl。使用http可以正常工作。现在,我已经使用certbot安装了证书,该网站将返回其工作页面的debian apache。

这是系统ctl重新启动后我的apache错误日志的最后两行

[pid 2019:tid 139908538110016] AH00489: Apache/2.4.25 (Debian) OpenSSL/1.0.2u mod_wsgi/4.6.5 Python/3.7 configured  -- resuming normal operations
[pid 2019:tid 139908538110016] AH00094: Command line: '/usr/sbin/apache2'

以下是我用于VirtualHost 443的配置

        ServerName example.com
        ServerAlias www.example.com
        ServerAdmin [email protected]

        SSLEngine On

        Alias /static /home/debian/static
        <Directory /home/debian/static>
                Require all granted
        </Directory>

        <Directory /home/debian/quizapp/quizapp>
          <Files wsgi.py>
                    Require all granted
          </Files>
        </Directory>

        WSGIDaemonProcess quizapp python-home=/home/debian/quizapp/mqbenv python-path=/home/debian/quizapp
        WSGIProcessGroup quizapp
        WSGIScriptAlias / /home/debian/quizapp/quizapp/wsgi.py

RewriteEngine on

Include /etc/letsencrypt/options-ssl-apache.conf
SSLCertificateFile /etc/letsencrypt/live/exapmle.com/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/example.com/privkey.pem

相同的配置适用于未启用SSLEngine的http站点。此配置以前可以用于http,但现在显示“ It works”页面。是因为我从启用站点的站点上删除了该站点吗?因为现在它包含两个站点,所以不应该发生。

这里可能是什么问题?

而且,我的服务器不响应https请求。我在ufw防火墙中允许使用https 443端口。netstat返回此

sudo netstat -tulpn | grep LISTEN

tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      876/sshd
tcp        0      0 127.0.0.1:25            0.0.0.0:*               LISTEN      1171/master
tcp6       0      0 :::33060                :::*                    LISTEN      879/mysqld
tcp6       0      0 :::3306                 :::*                    LISTEN      879/mysqld
tcp6       0      0 :::80                   :::*                    LISTEN      2307/apache2
tcp6       0      0 :::22                   :::*                    LISTEN      876/sshd
tcp6       0      0 :::443                  :::*                    LISTEN      2307/apache2

这意味着apache已识别python,正在80和443端口上侦听。但是在443上请求此操作会给我一个错误“服务器花费了很长时间才能响应”]

[请帮助我,自2天以来我一直坚持下去,无法到达任何地方。

我试图通过apache2网络服务器的LetsEncrypt certbot在Django网站上启用ssl。使用http可以正常工作。现在我已经使用certbot安装了证书,该网站...

django apache ssl python-3.7 mod-wsgi
1个回答
0
投票

如果http和https的配置相同,那么我认为您可能需要创建一个全局WSGIApplicationGroup。从两个虚拟主机(http和https)中删除WSGI参数,并将其添加到配置文件之一之外。例如,将其添加到000-default.conf文件的顶部,

© www.soinside.com 2019 - 2024. All rights reserved.