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

I'm having trouble configurig multiple ssl hosts on my apache server (CentOS). Originally I thought the problem was only having one IP, so once this was discovered I asked our server provider to add another IP which they did.

However, I'm still having problems. We want to be able to have http & https access for both of our domains, domain1.com & domain2.com as well as having various subdomains.

I have the certificates, keys, intermediate certs on the machine (for both domains) and these appear to be fine.

The situation is that all the HTTP sites are working correctly, and the first SSL domain is working but when I try and visit the second domain over HTTPS I get a security error (says wrong certificate as is showing domain 1's cert!).

Also, the pages being served to domain2 are not the correct oes (i.e not what the DocumentRoot says!). It appears as though it is defaulting to the first ssl config for all domains/ips.

Config Files:

THis is an excerpt from httpd.conf
####
NameVirtualHost **.**.**.27:80

<VirtualHost **.**.**.27:80>
    DocumentRoot /var/www/html/ADDIR
    ServerName domain1.com
    ErrorDocument 404 /var/www/html/404.html
</VirtualHost>

 # # There are other virtualhosts for other ServerNames & DocumentRoots too but they're otherwise identical to above. ###

<Location "/usage">
</Location>

NameVirtualHost **.**.**.41:80

<VirtualHost **.**.**.41:80>
DocumentRoot /var/www/html/SOC
ServerName domain2.com
</VirtualHost>

# # #
This is an excerpt from ssl.conf

<VirtualHost **.**.**.27:443>
DocumentRoot "/var/www/html/ADDIR/"
ServerName domain1.com:443
ErrorLog logs/ssl_error_log
TransferLog logs/ssl_access_log
LogLevel warn
SSLEngine on
SSLProtocol all -SSLv2
SSLCipherSuite ALL:!ADH:!EXPORT:!SSLv2:RC4+RSA:+HIGH:+MEDIUM:+LOW

#certificates
SSLCertificateFile /ssl/server.crt
SSLCertificateKeyFile /ssl/server.key
SSLCACertificateFile /ssl/intermediate.crt

<Files ~ "\.(cgi|shtml|phtml|php3?)$">
    SSLOptions +StdEnvVars
</Files>
<Directory "/var/www/cgi-bin">
 SSLOptions +StdEnvVars
</Directory>

SetEnvIf User-Agent ".*MSIE.*" \
        nokeepalive ssl-unclean-shutdown \
         downgrade-1.0 force-response-1.0

CustomLog logs/ssl_request_log \
          "%t %h %{SSL_PROTOCOL}x %{SSL_CIPHER}x \"%r\" %b"
</VirtualHost>                                  

<VirtualHost **.**.**.41:443>
     SSLEngine On
     SSLCertificateFile /ssl/SD/server.crt
     SSLCertificateKeyFile /ssl/SD/server.key
     SSLCACertificateFile /ssl/SD/intermediate.crt

     ServerAdmin info@mydomain.com
     ServerName domain2.com
     DocumentRoot /var/www/html/SOC/
</VirtualHost>
share|improve this question
    
To be helped you need to give more information: what is not working? What is the problem? Which is your configuration? –  Matteo Sep 5 '12 at 11:34
    
Hi. @Matteo All the HTTP sites are working correctly, and the first SSL domain is working but when I try and visit the second domain over HTTPS I get a security error (says wrong certificate as is showing domain 1's cert!). Also, the pages being displayed are not the correct oes (i.e not what the DocumentRoot says!). It appears as though it is defaulting to the first ssl config for all domains/ips. And bob, I already said I have two IPs as that was the original problem. –  swiss196 Sep 5 '12 at 11:54
    
@bobmagoo He got multiple IPs so he can configure one domain for each IP. –  Matteo Sep 5 '12 at 12:08
    
@swiss196 you should really edit your question and add the relevant part of your configuration as it is impossible to know what you did if you don't tell us. –  Matteo Sep 5 '12 at 12:09
    
Updated @Matteo and now removed Dave! –  swiss196 Sep 5 '12 at 12:26
show 1 more comment

migrated from superuser.com Sep 9 '12 at 16:59

This question came from our site for computer enthusiasts and power users.

1 Answer

Just comparing the definitions of the two https virtual hosts, I see discrepancies.

On your .27 Virtualhost, you have

ServerName domain1.com:443

SSLProtocol all -SSLv2

SSLCipherSuite ALL:!ADH:!EXPORT:!SSLv2:RC4+RSA:+HIGH:+MEDIUM:+LOW

and on your .41 Virtualhost, you have

ServerName domain2.com

I'll readily admit I don't understand all the SSL config, so maybe this is as intended. But you've got one working correctly (I assume the .27 host), and the other setup differently.

share|improve this answer
add comment

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.