2017-11-27 17 views
0

私はmail.mydomain.comサブドメインにroundcubeを設定しました。これはApacheの設定例を使用しています。 httpsでルートドメインにアクセスしようとすると、(サブドメインにリダイレクトされずに)ラウンドキューのインターフェイスが表示されます。RoundcubeはすべてのHTTPS要求をキャッチします

# Apache2 vhost configuration sample for Roundcube 
# https://linode.com/docs/email/clients/installing-roundcube-on-ubuntu-14-04/ 

<VirtualHost *:80> 
    # Virtual host configuration + information (replicate changes to *:443 below) 
    ServerAdmin [email protected] 
    ServerName mail.luckypizza.ro 
    ServerAlias mail.laiancu.ro 
    DocumentRoot /var/www/roundcube 
    ErrorLog /var/log/apache2/webmail/error.log 
    CustomLog /var/log/apache2/webmail/access.log combined 

    # Permanently redirect all HTTP requests to HTTPS 
    RewriteEngine on 
    RewriteCond %{SERVER_PORT} !^443$ 
    RewriteRule ^/(.*) https://%{HTTP_HOST}/$1 [NC,R=301,L] 
</VirtualHost> 

<IfModule mod_ssl.c> 
<VirtualHost *:443> 
    # Virtual host configuration + information (replicate changes to *:80 above) 
    ServerAdmin [email protected] 
    ServerName mail.mydomain.ro 
    ServerAlias mail.myotherdomain.ro 
    DocumentRoot /var/www/roundcube 
    # ErrorLog /var/log/apache2/webmail/error.log 
    # CustomLog /var/log/apache2/webmail/access.log combined 

    # SSL certificate + engine configuration 
    SSLEngine on 
    SSLCertificateFile /etc/letsencrypt/live/mail.mydomain.ro/fullchain.pem 
    SSLCertificateKeyFile /etc/letsencrypt/live/mail.mydomain.ro/privkey.pem 

    # Roundcube directory permissions + restrictions 
    <Directory /var/www/roundcube> 
    Options -Indexes 
    AllowOverride All 
    </Directory> 
    <Directory /var/www/roundcube/config> 
    Order Deny,Allow 
    Deny from All 
    </Directory> 
    <Directory /var/www/roundcube/temp> 
    Order Deny,Allow 
    Deny from All 
    </Directory> 
    <Directory /var/www/roundcube/logs> 
    Order Deny,Allow 
    Deny from All 
    </Directory> 
</VirtualHost> 
</IfModule> 

私はそうのように、ルートのウェブサイトのために、この設定を複製しています構成で間違っているように思わ

<VirtualHost *:80> 
    # Virtual host configuration + information (replicate changes to *:443 below) 
    ServerAdmin [email protected] 
    ServerName mydomain.ro 
    ServerAlias www.mydomain.ro 
    DocumentRoot /var/www/mydomain/root/public 
    ErrorLog /var/log/apache2/lucky_error.log 
    CustomLog /var/log/apache2/lucky_access.log combined 

    # Permanently redirect all HTTP requests to HTTPS 
    RewriteEngine on 
    RewriteCond %{SERVER_PORT} !^443$ 
    RewriteRule ^/(.*) https://%{HTTP_HOST}/$1 [NC,R=301,L] 
</VirtualHost> 

<IfModule mod_ssl.c> 
<VirtualHost *:443> 
    # Virtual host configuration + information (replicate changes to *:80 above) 
    ServerAdmin [email protected] 
    ServerName mydomain.ro 
    ServerAlias www.mydomain.ro 
    DocumentRoot /var/www/mydomain/root/public 
    # ErrorLog /var/log/apache2/lucky_error.log 
    # CustomLog /var/log/apache2/lucky_access.log combined 

    # SSL certificate + engine configuration 
    SSLEngine on 
    SSLCertificateFile /etc/letsencrypt/live/mydomain.ro/fullchain.pem 
    SSLCertificateKeyFile /etc/letsencrypt/live/mydomain.ro/privkey.pem 

    # Roundcube directory permissions + restrictions 
    <Directory /var/www/mydomain/root/public> 
    Options -Indexes 
    AllowOverride All 
    </Directory> 
    </VirtualHost> 
</IfModule> 

何?

+0

新しい仮想ホストを古い.confファイルに置きましたか?それらが別々のフォルダにある場合は、新しい.confファイルを置いたフォルダに正確に入れましたか? –

+0

@Dusan Bajic同じフォルダ、同じファイル、実際には古いものが置き換えられてmydomain.ro.confとmail.mydomain.ro.confがある – Sergiu

+0

申し訳ありませんが、私はそれを取得しませんでした。同じファイルであれば、2つのファイルがあると言います。 .confファイルが2つある場合(メールドメインの場合は1つ、ルートドメインの場合は1つ)、.confファイルが存在する正確な場所(そのフォルダへのフルパス)は何ですか? –

答えて

0

この問題は、サーバー側でSNIサポートが不足しているため、同じ仮想ホストへのすべての要求が先行している可能性があります。前提条件をここで確認できます:https://wiki.apache.org/httpd/NameBasedSSLVHostsWithSNI また、2つの仮想ホストのいずれかを削除してテストし、戻して2番目のテストを削除してテストすることもできます。

+0

メールを無効にする.mydomain.ro.confでは、ルートはhttpsで動作します。これにより、メール設定が以前の仮想ホストの設定を上書きすることが確認されます。 – Sergiu

+0

Apacheバージョン(2.2または2.4)に従って、バーチャルホストを設定するときに少し違いがあります。 2.2では、NameVirtualHostディレクティブが必要です。 –

+0

'.conf'ファイルの先頭に' NameVirtualHost *:443'を置いて、私がルートにアクセスしたときにメールビューを取得します。 – Sergiu

関連する問題