2017-11-27 2 views
0

Apache 구성 예를 사용하여 mail.mydomain.com 하위 도메인에 roundcube를 설정했습니다. roundcube와 함께 제공됩니다. 이제 https에서 루트 도메인에 도달하려고하면 하위 도메인으로 리디렉션하지 않고 roundcube 인터페이스를 표시합니다.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 파일에 배치 했습니까? 그들이 분리 된 폴더에 정확히 어떤 폴더에 새로운 .conf 파일을 넣었습니까? –

+0

@Dusan Bajic 같은 폴더, 실제로 동일한 파일, 이전의 것들이 대체되어 mydomain.ro.conf와 mail.mydomain.ro.conf가 있습니다. – Sergiu

+0

미안하지만, 나는 그것을 얻지 못했습니다. 같은 파일이면 두 파일이 있다고 가정합니다. 두 개의 .conf 파일 (메일 도메인 용, 하나의 루트 도메인 용)이있는 경우 .conf 파일이있는 정확한 위치 (해당 폴더의 전체 경로)는 무엇입니까? –

답변

0

이 문제는 서버 측에서 SNI 지원이 부족하여 동일한 가상 호스트에 대한 모든 요청을 처리하는 것과 관련 될 수 있습니다. 여기서 사전 조건을 점검 할 수 있습니다 : https://wiki.apache.org/httpd/NameBasedSSLVHostsWithSNI 두 개의 가상 호스트 중 하나를 제거하고 테스트 한 다음 다시 가져와 두 번째 테스트를 제거하여 테스트 할 수 있습니다.

+0

메일을 비활성화하면 .mydomain.ro.conf에서 루트는 https에서 작동합니다. 이렇게하면 메일 구성이 이전 가상 호스트의 설정을 덮어 씁니다. – Sergiu

+0

Apache 버전 (2.2 또는 2.4)에 따라 가상 호스트를 구성 할 때 약간의 차이점이 있습니다. 2.2에서는 NameVirtualHost 지시어가 필요합니다. –

+0

'.conf' 파일의 시작 부분에'NameVirtualHost * : 443'을 넣었습니다. 루트를 방문 할 때 전자 메일보기가 표시됩니다. – Sergiu

관련 문제