villiwalla
@villiwalla
HTML-верстка

Почему Apache перекидывает на дефолтный хост?

Получил в ручном режиме сертификат Lets crypt, исправил конфиг хоста:

ServerName site.ru
DocumentRoot /var/www/site
DirectoryIndex index.php index.html

<VirtualHost *:80>
        RewriteEngine On
        RewriteCond %{HTTPS} off
        RewriteRule ^(.*) https://%{HTTP_HOST}%{REQUEST_URI}
</VirtualHost>


<VirtualHost *:443>
        AddDefaultCharset UTF-8
  # LOGS
        LogLevel info ssl:error
        CustomLog /var/www/logs/site-access.log combined
        ErrorLog /var/www/logs/site-error.log

        SSLEngine On
        SSLCertificateFile /etc/letsencrypt/live/site.ru/cert.pem
        SSLCertificateKeyFile /etc/letsencrypt/live/site.ru/privkey.pem

        <Directory /var/www/site>
                Options -Indexes +FollowSymLinks +MultiViews
                AllowOverride All
                Order allow,deny
                allow from all
        </Directory>
</VirtualHost>


Перехожу по адресу site.ru и меня перекидывает на дефолтный адрес сервера, а не на https://site.ru. Но, если перейти по адресу site.ru/index.html, то редирект происходит на https://site.ru/index.html, если вбить адрес https://site.ru сайт доступен как положено.

В чём может быть проблема?
apachectl -t -D DUMP_MODULES

Loaded Modules:
 core_module (static)
 so_module (static)
 watchdog_module (static)
 http_module (static)
 log_config_module (static)
 logio_module (static)
 version_module (static)
 unixd_module (static)
 access_compat_module (shared)
 alias_module (shared)
 auth_basic_module (shared)
 authn_core_module (shared)
 authn_file_module (shared)
 authz_core_module (shared)
 authz_host_module (shared)
 authz_user_module (shared)
 autoindex_module (shared)
 deflate_module (shared)
 dir_module (shared)
 env_module (shared)
 filter_module (shared)
 gnutls_module (shared)
 mime_module (shared)
 mpm_prefork_module (shared)
 negotiation_module (shared)
 php7_module (shared)
 rewrite_module (shared)
 setenvif_module (shared)
 socache_shmcb_module (shared)
 ssl_module (shared)
 status_module (shared)


apachectl -t -D DUMP_VHOSTS

*:80                   is a NameVirtualHost
         default server default.ru (/etc/apache2/sites-enabled/000-default.conf:1)
         port 80 namevhost default.ru (/etc/apache2/sites-enabled/000-default.conf:1)
         port 80 namevhost site.ru (/etc/apache2/sites-enabled/site.ru.conf:5)
*:443                  site.ru(/etc/apache2/sites-enabled/site.ru.conf:12)

  • Вопрос задан
  • 146 просмотров
Пригласить эксперта
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Войти через центр авторизации
Похожие вопросы