In httpd.conf


ServerName testsite.com:80
DocumentRoot /usr/share/web
<Directory /usr/share/web>
// usual stuff from documentation

Include httpd-vhost is uncommented

in httpd-vhost.conf

NameVirtualHost *

<VirtualHost *>
  DocumentRoot "/usr/share/web/a"
  ServerName www.testsite.com
  ServerAlias testsite.com

<VirtualHost *>
  DocumentRoot "/usr/share/web/b"
  ServerName site.testsite.com
  ServerAlias site

in /etc/hosts localhost testsite.com www.testsite.com site.testsite.com

if I goto site.testsite.com, testsite.com www.testsite.com I get served the page from /usr/share/web



In httpd.conf, you're specifically listening on port 80, but your virtual hosts are not specifying a port.

Change to the following:

NameVirtualHost *:80

and in each of your VirtualHost containers:

<VirtualHost *:80>

Also, you're defining the same ServerName in httpd.conf and httpd-vhost.conf -- I recommend changing the one in httpd.conf to something else.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy