rfc1484
rfc1484

Reputation: 9837

Hosting multiple sites with Apache2

I have on a server machine a local domain called "localwiki.com" that points to /var/www/wiki and works fine.

The sites-available and sites-enable configuration:

<VirtualHost *:80>
DocumentRoot /var/www/wiki/
ServerName localwiki.com
ServerAlias *.localwiki.com
</VirtualHost>

I wanted to create a second local domain for /var/www/doxygen (which I can access using "serverIP"/doxygen).

Here is the localdoxygen.com config file created at /etc/apache2/sites-available/localdoxygen.com

<VirtualHost *:80>
DocumentRoot /var/www/doxygen/
ServerName localdoxygen.com
ServerAlias *localdoxygen.com
</VirtualHost>

I used "a2ensite" in order to create a symbolic link in sites-enable pointing to localdoxygen.com in sites-available:

sudo a2ensite localdoxygen.com

I also have reloaded the new configuration:

sudo /etc/init.d/apache2 reload

And restarted apache:

sudo service apache2 restart

But the domain (localdoxygen.com), still doesn't work.

Any suggestions on how to fix this?

Upvotes: 0

Views: 1022

Answers (4)

wuliang
wuliang

Reputation: 749

  1. disable the default site - a2dissite default (!!!)
  2. DNS correct
  3. check in /etc/apache2/sites-enabled have your sites
  4. reload apache2 /etc/init.d/apache2 reload

Upvotes: 1

Brian P Johnson
Brian P Johnson

Reputation: 703

I think those conf files must end in .conf to be loaded: i.e. localdoxygen.com.conf

Upvotes: 1

rfc1484
rfc1484

Reputation: 9837

To solve the problem I had to add an entry to /etc/bind in order to activate the DNS for the domain.

Upvotes: 3

H6_
H6_

Reputation: 32788

You need to define a NameVirtualHost in your apache2.conf to support multiple domains under one IP.

NameVirtualHost 123.456.789.123:80

or

NameVirtualHost *:80

see also Running several name-based web sites on a single IP address.

Upvotes: 0

Related Questions