_default_ VirtualHost se sobrepõem na porta 443, o primeiro tem precedência

61

Eu tenho dois aplicativos ruby on rails 3 rodando no mesmo servidor, (ubuntu 10.04), ambos com SSL.

Aqui está o meu arquivo de configuração do Apache:

<VirtualHost *:80>
ServerName example1.com
DocumentRoot /home/me/example1/production/current/public
</VirtualHost>
<VirtualHost *:443>
ServerName example1.com
DocumentRoot /home/me/example1/production/current/public
SSLEngine on
SSLCertificateFile /home/me/example1/production/shared/example1.crt
SSLCertificateKeyFile /home/me/example1/production/shared/example1.key
SSLCertificateChainFile /home/me/example1/production/shared/gd_bundle.crt
SSLProtocol -all +TLSv1 +SSLv3
SSLCipherSuite HIGH:MEDIUM:!aNULL:+SHA1:+MD5:+HIGH:+MEDIUM
</VirtualHost>


<VirtualHost *:80>
ServerName example2.com
DocumentRoot /home/me/example2/production/current/public
</VirtualHost>
<VirtualHost *:443>
ServerName example2.com
DocumentRoot /home/me/example2/production/current/public
SSLEngine on
SSLCertificateFile /home/me/example2/production/shared/iwanto.crt
SSLCertificateKeyFile /home/me/example2/production/shared/iwanto.key
SSLCertificateChainFile /home/me/example2/production/shared/gd_bundle.crt
SSLProtocol -all +TLSv1 +SSLv3
SSLCipherSuite HIGH:MEDIUM:!aNULL:+SHA1:+MD5:+HIGH:+MEDIUM
</VirtualHost>

Qual é o problema:

Ao reiniciar meu servidor, isso me dá uma saída assim:

 * Restarting web server apache2                                   
 [Sun Jun 17 17:57:49 2012] [warn] _default_ VirtualHost overlap on port 443, the first has precedence
 ... waiting [Sun Jun 17 17:57:50 2012] [warn] _default_ VirtualHost overlap on port 443, the first has precedence

Ao pesquisar por que esse problema está chegando, recebi algo assim:

Não é possível usar hosts virtuais baseados em nome com SSL porque o handshake SSL (quando o navegador aceita o certificado do servidor Web seguro) ocorre antes da solicitação HTTP, que identifica o host virtual baseado em nome apropriado. Se você planeja usar hosts virtuais baseados em nome, lembre-se de que eles só funcionam com seu servidor da Web não seguro.

Mas não é possível descobrir como executar dois aplicativos ssl no mesmo servidor.

Alguém pode me ajudar?

    
por Mohit Jain 17.06.2012 / 22:42

3 respostas

85

Quase lá!

Adicione isto ao ports.conf ou http.conf e mantenha sua configuração acima.

<IfModule mod_ssl.c>
    # If you add NameVirtualHost *:443 here, you will also have to change
    # the VirtualHost statement in /etc/apache2/sites-available/default-ssl
    # to <VirtualHost *:443>
    # Server Name Indication for SSL named virtual hosts is currently not
    # supported by MSIE on Windows XP.

    # !important below!
    NameVirtualHost *:443 
    Listen 443
</IfModule>
    
por 01.10.2012 / 07:52
2

Ele me ajudou a executar "/ usr / sbin / apachectl -S" também. Esta saída de comando mostra DOIS arquivos "ssl.conf" no mesmo caminho. Mova ou apague o arquivo infrator e tudo deve funcionar depois.

    
por 08.08.2013 / 21:10
0

Você pode adicionar isso à sua configuração do apache em /etc/apache2/ports.conf :

<IfModule mod_ssl.c>                
    Listen 443                      
    <IfModule !mod_authz_core.c>    
        # Apache 2.2                
        NameVirtualHost *:443       
    </IfModule>                     
</IfModule>                         

(Isso funciona em ambos: apache 2.2 e 2.4)

    
por 17.05.2016 / 13:21