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 have two IPs that I can use on my linode, I have three websites running on the server all on different domains, two of them run also on SSL

Here is the relevant parts of my httpd.conf (running Apache2 on CentOS 6.2):

NameVirtualHost 178.79.165.220:80
NameVirtualHost 176.58.116.80:80
NameVirtualHost 176.58.116.80:443
NameVirtualHost 178.79.165.220:443


<VirtualHost 178.79.165.220:80>
  ServerAdmin report@domain3.com
  ServerName  domain3.com
  ServerAlias www.domain3.com
  DirectoryIndex index.php
  DocumentRoot /var/www/domain3.com/public_html/
  LogLevel warn
  ErrorLog  /var/www/domain3.com/logs/error.log
  CustomLog /var/www/domain3.com/logs/access.log combined
</VirtualHost>

<VirtualHost 178.79.165.220:80>
  ServerAdmin report@domain1.com
  ServerName  domain1.com
  ServerAlias www.domain1.com
  DirectoryIndex index.php
  DocumentRoot /var/www/domain1.com/public_html/
  LogLevel warn
  ErrorLog  /var/www/domain1.com/logs/error.log
  CustomLog /var/www/domain1.com/logs/access.log combined
</VirtualHost>

<VirtualHost 178.79.165.220:443>
  ServerAdmin report@domain1.com
  ServerName  domain1.com
  ServerAlias www.domain1.com
  SSLEngine on
  SSLCertificateFile /etc/ssl/certs/domain1.com/domain1.com.crt
  SSLCertificateKeyFile /etc/ssl/certs/domain1.com/domain1.com.key
  SSLCertificateChainFile /etc/ssl/certs/domain1.com/domain1.com.bundle.crt

  DirectoryIndex index.php
  DocumentRoot /var/www/domain1.com/public_html/
  LogLevel warn
  ErrorLog  /var/www/domain1.com/logs/error.log
  CustomLog /var/www/domain1.com/logs/access.log combined
</VirtualHost>

<VirtualHost 176.58.116.80:80>
  ServerAdmin info@domain2.com
  ServerName  domain2.com
  ServerAlias www.domain2.com
  DirectoryIndex index.php
  DocumentRoot /var/www/domain2.com/public_html/
  LogLevel warn
  ErrorLog  /var/www/domain2.com/logs/error.log
  CustomLog /var/www/domain2.com/logs/access.log combined
</VirtualHost>

<VirtualHost 176.58.116.80:443>
  ServerAdmin info@domain2.com
  ServerName  domain2.com
  ServerAlias www.domain2.com
  SSLEngine on
  SSLCertificateFile /etc/ssl/certs/sba/sba.crt
  SSLCertificateKeyFile /etc/ssl/certs/sba/sba.key
  SSLCertificateChainFile /etc/ssl/certs/sba/sba-bundle.crt

  DirectoryIndex index.php
  DocumentRoot /var/www/domain2.com/public_html/
  LogLevel warn
  ErrorLog  /var/www/domain2.com/logs/error.log
  CustomLog /var/www/domain2.com/logs/access.log combined
</VirtualHost>

The issue is that if you go to domain3, you basically get to domain1 for some reason.

share|improve this question
    
I think what you want is to get another IP address: 1 for each SSL site and one for all sites without SSL enabled. –  xofer Jun 3 '13 at 22:34
    
@xofer I should be doing exactly that, however the current set up should disqualify the SSL Certificate but still get all the virtual hosts running correctly, or am I wrong? –  Or W Jun 3 '13 at 22:41
    
Exactly what is the problem you're having? –  Michael Hampton Jun 4 '13 at 0:51
    
@MichaelHampton When navigating to domain3.com I am seeing the domain1.com content for some reason. –  Or W Jun 4 '13 at 6:38
    
You said that already. But you didn't say whether it was HTTP or HTTPS. –  Michael Hampton Jun 4 '13 at 6:38
show 1 more comment

1 Answer

Try adding

NameVirtualHost 178.79.165.220:80

to the configuration. You currently have NameVirtualHost *:80, which isn't relevant to the 178.79.165.220:80 socket that is shared between domain1.com and domain3.com.

share|improve this answer
    
I've tried adding both IPs under two separate lines of NameVirtualHost and still I'm getting the same behaviour –  Or W Jun 3 '13 at 22:25
    
+1 NameVirtualHost x:y and <VirtualHost x:y> must be identical. –  xofer Jun 3 '13 at 22:35
    
@xofer please see my latest edit, this still shows the same behaviour –  Or W Jun 3 '13 at 22:40
    
yep saw it, and despite the fact that it didn't solve the problem entirely, your setup wouldn't have worked without it. –  xofer Jun 3 '13 at 23:23
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.