Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I have two ruby on rails 3 applications running on same server, (ubuntu 10.04), both with SSL.

Here is my apache config file:

<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>

Whats the issue:

On restarting my server it gives me some output like this:

 * 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

On googling why this issue is coming I got something like this:

You cannot use name based virtual hosts with SSL because the SSL handshake (when the browser accepts the secure Web server's certificate) occurs before the HTTP request, which identifies the appropriate name based virtual host. If you plan to use name-based virtual hosts, remember that they only work with your non-secure Web server.

But not able to figure out how to run two ssl application on same server.

Can any one help me?

share|improve this question
5  
You don't have any _default_ vhosts in the config you've provided, so they're elsewhere. What's the output of apache2ctl -S? (Yes, it is possible to run multiple SSL name-based vhosts on different certificates, provided you don't have any need to support client browsers running Windows XP or any others that don't support TLS SNI. Do you need to support Windows XP?) –  Shane Madden Jun 17 '12 at 22:48

2 Answers 2

up vote 33 down vote accepted

Almost there!

Add this to ports.conf or http.conf and keep your above config.

<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>
share|improve this answer
    
The comment "# !important! needs to be removed or moved to another line. Otherwise, thank you very much for interpreting this inaccurate error message for me. –  flickerfly Sep 10 at 19:03
    
This no longer works in Apache 2.4.7 –  indiekiduk Oct 3 at 19:25

It helped me executing " /usr/sbin/apachectl -S" also. This command exit shows TWO "ssl.conf" files on the same path. Move or delete the offender file and everything should work after.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.