0

In httpd.conf

Listen 127.0.0.1:80

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

Include httpd-vhost is uncommented

in httpd-vhost.conf

NameVirtualHost *

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

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

in /etc/hosts

127.0.0.1 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

Thanks

0

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.

Your Answer

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