Назад | Перейти на главную страницу

Невозможно добавить HTTPS в поддомен

Прошло 5 дней, и я схожу с ума по этому поводу.

Я пытаюсь установить сертификат Let's Encrypt на созданный мной поддомен, но не могу заставить его работать.

Вот мои файлы .conf в доступных для сайтов:

test.com.conf

<VirtualHost *:80>
    ServerAdmin webmaster@localhost
    ServerName test.com
ServerAlias www.test.com
    DocumentRoot /var/www
    <Directory />
        Options FollowSymLinks
        AllowOverride All
    </Directory>
    <Directory /var/www/>
        Options Indexes FollowSymLinks MultiViews
        AllowOverride All
        Order allow,deny
        allow from all
    </Directory>

    ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
    <Directory "/usr/lib/cgi-bin">
        AllowOverride All
        Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
        Order allow,deny
        Allow from all
    </Directory>

    ErrorLog ${APACHE_LOG_DIR}/error.log

    # Possible values include: debug, info, notice, warn, error, crit,
    # alert, emerg.
    LogLevel warn

    CustomLog ${APACHE_LOG_DIR}/access.log combined
RewriteEngine on
RewriteCond %{SERVER_NAME} =www.test.com
RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [L,NE,R=permanent]
</VirtualHost>

Так что это работает, и у меня есть test-le-ssl.conf Создано на сайтах-доступных.

И вот мой whydoesntitwork.test.com.conf

<VirtualHost *:80>
    ServerAdmin webmaster@localhost

    DocumentRoot /var/www/whydoesntitwork
    <Directory />
        Options FollowSymLinks
        AllowOverride All
    </Directory>
    <Directory /var/www/whydoesntitwork>
        Options Indexes FollowSymLinks MultiViews
        AllowOverride All
        Order allow,deny
        allow from all
    </Directory>

    ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
    <Directory "/usr/lib/cgi-bin">
        AllowOverride All
        Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
        Order allow,deny
        Allow from all
    </Directory>

    ErrorLog ${APACHE_LOG_DIR}/error.log

    # Possible values include: debug, info, notice, warn, error, crit,
    # alert, emerg.
    LogLevel warn

    CustomLog ${APACHE_LOG_DIR}/access.log combined

</VirtualHost>

Когда я запускаю ./letsencrypt-auto или добавляю -d test.com -d whydoesntitwork.com, меня спрашивают, хочу ли я продлить или попытаться переустановить. Я переустанавливаю, потому что не хочу, чтобы меня заблокировали (говорят, что можно делать ~ 5-7 раз в неделю).

Ошибка, которую я получаю при попытке установить SSL на whydoesntitwork:

The selected vhost would conflict with other HTTPS VirtualHosts within Apache. Please select another vhost or add ServerNames to your configuration.
VirtualHost not able to be selected.

Я уже добавил два домена на /etc/apache2/hosts как показано ниже:

127.0.0.1 localhost.localdomain localhost
(myip)        test.com   test
(myip)        whydoesntitwork.test.com        whydoesntitwork

Что я делаю не так ?

EDIT: добавлена ​​версия apache

Server version: Apache/2.2.22 (Debian)
Server built:   Sep 21 2017 20:51:54

Спасибо

В Apache 2.2 вам нужно будет установить NameVirtualHost

NameVirtualHost *:80

Кроме того, вам кажется, что вам не хватает директивы ServerName во второй конфигурации.

Наконец, включили ли вы конфигурацию, доступную для сайтов?