Apache2 | 1个IP的2个域| SSL配置1x普通1x通配符

时间:2018-09-23 19:13:56

标签: ssl apache2 subdomain

我有2个域。 domain2.io(两个子域)和Wildcard SSLdomain1.denormal SSL。 我的问题是domain2.io以某种方式使用了domain1.de中的SSL。我怎么了这是我的配置:

000-default.conf:

    <VirtualHost *:80>
        ServerName domain1.de
        ServerAlias www.domain1.de
        Redirect / https://www.domain1.de/
</VirtualHost>

<VirtualHost *:80>
        ServerName domain2.io
        ServerAlias www.domain2.io
        Redirect / https://domain2.io/
</VirtualHost>

<VirtualHost *:80>
        ServerName service.domain2.io
        ServerAlias www.service.domain2.io
        Redirect / https://service.domain2.io
</VirtualHost>

<VirtualHost *:80>
        ServerName webapp.domain2.io
        ServerAlias www.webapp.domain2.io
        Redirect / https://webapp.domain2.io
</VirtualHost>

这是我的000-default-ssl.conf:

    NameVirtualHost *:443

<IfModule mod_ssl.c>
        <VirtualHost *:443>
                ServerAdmin webmaster@localhost
                ServerName domain1.de
                DocumentRoot /var/www/html/apps/domain1/new/
                ErrorLog ${APACHE_LOG_DIR}/error.log
                CustomLog ${APACHE_LOG_DIR}/access.log combined.
                SSLEngine on
                SSLCertificateFile    /etc/apache2/ssl/domain1/domain1.de.crt
                SSLCertificateKeyFile /etc/apache2/ssl/domain1/domain1.de.key
        </VirtualHost>

        <VirtualHost *:443>
                ServerName domain2.io
                DocumentRoot /var/www/html/websites/domain2/webapp/
                ErrorLog ${APACHE_LOG_DIR}/error.log
                CustomLog ${APACHE_LOG_DIR}/access.log combined.
                SSLEngine on
                SSLCertificateFile    /etc/apache2/ssl/domain2/domain2.io.crt
                SSLCertificateKeyFile /etc/apache2/ssl/domain2/domain2.io.key
        </VirtualHost>

        <VirtualHost *:443>
                ServerName service.domain2.io
                ServerAlias www.service.domain2.io
                DocumentRoot /var/www/html/websites/domain2/backend/
                ErrorLog ${APACHE_LOG_DIR}/error.log
                CustomLog ${APACHE_LOG_DIR}/access.log combined.
                SSLEngine on
                SSLCertificateFile    /etc/apache2/ssl/domain2/domain2.io.crt
                SSLCertificateKeyFile /etc/apache2/ssl/domain2/domain2.io.key
        </VirtualHost>

        <VirtualHost *:443>
                ServerName webapp.domain2.io
                ServerAlias www.webapp.domain2.io
                DocumentRoot /var/www/html/apps/domain2/
                ErrorLog ${APACHE_LOG_DIR}/error.log
                CustomLog ${APACHE_LOG_DIR}/access.log combined.
                SSLEngine on
                SSLCertificateFile    /etc/apache2/ssl/domain2/domain2.io.crt
                SSLCertificateKeyFile /etc/apache2/ssl/domain2/domain2.io.key
        </VirtualHost>
</IfModule>

1 个答案:

答案 0 :(得分:1)

wildcart证书不起作用,因为它适用于* .domain2.io-因此它将与domain2.io不匹配。 因此,您需要domain2.io的单独证书-或使用www.domain2.io。

使用让我们加密证书来获取另一个证书应该没问题。