Отображение страницы по умолчанию Apache при использовании HTTPS с использованием проекта Django

Я уже неделю пытался заставить это работать, но похоже, что это не работает вообще. Пожалуйста, помогите, вот файлы для default-ssl и 001-default, веб-сайт работает нормально по http, но не работает по https. -

<IfModule mod_ssl.c>
<VirtualHost *:443>
    ServerAdmin eren9zero@gmail.com
    ServerName essayeshop.com
    ServerAlias www.essayeshop.com
    DocumentRoot /var/www/html

    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined

    SSLEngine on

    SSLCertificateFile /etc/apache2/ssl/apache.crt
    SSLCertificateKeyFile /etc/apache2/ssl/apache.key

    <FilesMatch "\.(cgi|shtml|phtml|php)$">
            SSLOptions +StdEnvVars
    </FilesMatch>
    <Directory /usr/lib/cgi-bin>
            SSLOptions +StdEnvVars
    </Directory>

    BrowserMatch "MSIE [2-6]" \
            nokeepalive ssl-unclean-shutdown \
            downgrade-1.0 force-response-1.0
</VirtualHost>

ServerName essayeshop.com
ServerAdmin eren9zero@gmail.com
DocumentRoot /var/www/html
# Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
# error, crit, alert, emerg.
# It is also possible to configure the loglevel for particular
# modules, e.g.
#LogLevel info ssl:warn

ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined


Alias /static /home/nick/website/static
<Directory /home/nick/website/static>
    Require all granted
</Directory>

<Directory /home/nick/website/website>
    <Files wsgi.py>
        Require all granted
    </Files>
</Directory>

WSGIDaemonProcess website python-path=/home/nick/website python-home=/home/nick/website/env
WSGIProcessGroup website
WSGIScriptAlias / /home/nick/website/website/wsgi.py
# For most configuration files from conf-available/, which are
# enabled or disabled at a global level, it is possible to
# include a line for only one particular virtual host. For example the
# following line enables the CGI configuration for this host only
# after it has been globally disabled with "a2disconf".
#Include conf-available/serve-cgi-bin.conf

0
задан 27 January 2020 в 20:27
1 ответ
<IfModule mod_ssl.c>
<VirtualHost *:443>
  ServerName  essayeshop.com
  ServerAlias www.essayeshop.com
  DocumentRoot  /var/www/html

  WSGIDaemonProcess essayeshop.com \
    python-home=/path/to/.virtualenv/mysite/ \
    python-path=/path/to/mysite/

  WSGIScriptAlias / /path/to/mysite/wsgi.py \
   process-group=mysite.com \
   application-group=%{GLOBAL}

  <Directory /path/to/mysite>
    <Files wsgi.py>
      Require all granted
    </Files>
  </Directory>

  <Directory /path/to/.virtualenvs/mysite>
    Require all granted
  </Directory>

  <Directory /path/to/mysite/logs>
    Require all granted
  </Directory>

  Alias /media/ /path/to/mysite/media/
  Alias /static/ /path/to/mysite/static/

  ErrorLog /var/log/apache2/mysite-error.log
  LogLevel warn
  CustomLog /var/log/apache2/mysite-access.log combined

  SSLEngine on
  SSLCertificateFile /path/to/cert/cert.pem
  SSLCertificateKeyFile /path/to/cert/privkey.pem
</VirtualHost>
</IfModule>

Нам нужно установить mod-wsgi, который представляет собой модуль apache для внедрения Python WSGI.

Включите сайт и необходимые моды

a2enmod ssl rewrite headers wsgi alias

и перезапустите службы apache

1
ответ дан 26 February 2020 в 00:36

Теги

Похожие вопросы