2017-05-05 13 views
0

現在、私のサーバーにはhttps/sslで実行されている1つのウェブサイトがあります。私が実行している最初のウェブサイトが新しいウェブサイトのSSL証明書を使用しているということは、https/sslで2番目の仮想ホストを有効にするときです。1つのIPで複数のSSLワイルドカード

私は2つのウェブサイトを1つのvhostファイルに入れようとしましたが、動作しませんでした。代わりに2つの別々のファイルを作成しました。ここで

は私のバーチャルホストの設定ファイルです:

(彼らにwebsiteZやウェブサイトYに名前を付けるためalfabeticalための彼らはしている)

<VirtualHost *:80> 
ServerAlias *.websiteZ.nl 
Redirect 301/https://websiteZ.nl 
</VirtualHost> 

NameVirtualHost *:443 

<IfModule mod_ssl.c> 
<VirtualHost *:443> 
    ServerName www.websiteZ.nl 
    DocumentRoot "/var/www/html/websites/websiteZ.nl/public" 
    <Directory "/var/www/html/websites/websiteZ.nl/public"> 
     Require all granted 
     Options Includes FollowSymLinks 
     AllowOverride All 
     Order allow,deny 
     Allow from all 
    </Directory> 
    SSLEngine On 
    SSLCertificateFile /etc/apache2/ssl/websiteZ.nl/certificate.crt 
    SSLCertificateKeyFile /etc/apache2/ssl/websiteZ.nl/certificate.key 
    SSLCertificateChainFile /etc/apache2/ssl/websiteZ.nl/cabundle.crt 
</VirtualHost> 
</IfModule> 

.confを

のvhost現在実行されているウェブサイトssl .confの新しいウェブサイト

<VirtualHost *:80> 
    ServerName websiteY.nl 
    ServerAlias www.websiteY.nl 
    RewriteEngine On 
    RewriteCond %{SERVER_PORT} !443 
    RewriteRule ^(.*)$ https://%{HTTP_HOST}$1 [R=301,L] 
    RewriteRule ^(/(.*))?$ https://%{HTTP_HOST}/$1 [R=301,L] 
    DocumentRoot "/var/www/html/websites/websiteY.nl/public/" 
    <Directory "/var/www/html/websites/websiteY.nl/public/"> 
     Require all granted 
     Options Includes FollowSymLinks 
     AllowOverride All 
     Order allow,deny 
     Allow from all 
    </Directory> 
</VirtualHost> 

<IfModule mod_ssl.c> 
<VirtualHost *:443> 
    ServerName www.websiteY.nl 
    DocumentRoot "/var/www/html/websites/websiteY.nl/public" 
    <Directory "/var/www/html/websites/websiteY.nl/public"> 
     Require all granted 
     Options Includes FollowSymLinks 
     AllowOverride All 
     Order allow,deny 
     Allow from all 
    </Directory> 
SSLStrictSNIVHostCheck on 
    SSLEngine On 
    SSLCertificateFile /etc/apache2/ssl/websiteY.nl/certificate.crt 
    SSLCertificateKeyFile /etc/apache2/ssl/websiteY.nl/certificate.key 
    SSLCertificateChainFile /etc/apache2/ssl/websiteY.nl/cabundle.crt 
</VirtualHost> 
</IfModule> 

ports.conf

NameVirtualHost *:80 
NameVirtualHost *:443 

Listen 80 

<IfModule mod_ssl.c> 
    Listen 443 
</IfModule> 

<IfModule ssl_module> 
     Listen 443 
</IfModule> 

<IfModule mod_gnutls.c> 
     Listen 443 
</IfModule> 

私はSNIの事を見上げたが、私は何かが欠けていると思います。私が理解していることは、NameVirtualHostを使って動作させる必要があることです。

サーバーiは、端末に入力したときに問題がoccorsのUbuntu 16.04.2

とAWSのece2上で実行されている:

a2ensite websiteY.conf 

私はwebsiteZはそれがHTTPS証明書だ失うことになると表示されますことを行うと大きな赤い十字架は言った:安全でない!あなたがクリックすると、それはウェブサイトへのリンクY

私は少し外れています、誰かが私を助けることができますか?ありがとう!

+0

端末 'a2ensite websiteY.conf'に端末を入力すると、どのような問題が発生しますか? –

+0

ありがとう、私は投稿を編集した: "私はそのウェブサイトZを行うと、それはhttpsの証明書を失うと大きな赤い十字架が表示されます:安全ではありません!をクリックして続行するには、WebサイトへのリンクY" –

+0

何**正確に** websiteZにアクセスしようとしているときにブラウザのアドレスバーに入力していますか? –

答えて

0

あなたはhttpsなしwww.websiteZ.nlを入力すると、要求は最初

<VirtualHost *:80> 
ServerAlias *.websiteZ.nl 
Redirect 301/https://websiteZ.nl 
</VirtualHost> 

にキャッチされ、したがって、あなたの:443仮想ホストのいずれもServerNameまたはwebsiteZ.nlで構成ServerAlias、どちらを持っていないのでhttps://websiteZ.nl

にリダイレクトアルファベット順の最初の.confファイルからのものが使用されます。この場合、websiteYの証明書を持つものです。

+0

あなたは、英雄です。私はこれを逃したとは信じられない!できます。 –

関連する問題