Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Creating a virtual host using webmin loads default site

So I'm trying to set up a rackspace cloud server to host multiple sites (not servers) with a single IP. I installed Virtualmin/Webmin on an Ubuntu 12.04 LTS server. I created the directory /var/www/sites/testsite. Then I created a virtual host under Webmin->Servers->Apache Webserver with the following settings:

Address: Any
Port: 80
Document Root: /var/www/sites/testsite
Server Name: testsite.com

Then, to test it, I edited the hosts file on my local machine and added

[my.server.ip.address] testsite.com

Then went to testsite.com in my browser and problem is it's loading the default site (at /var/www) instead of the virtual one I just created (I verfied this by adding different index.html files in /var/www and /var/www/sites/testsite).

Here are the directives webmin created in /etc/apache2/sites-available/webmin.1372454178.conf

DocumentRoot /var/www/sites/testsite
<Directory "/var/www/sites/testsite">
allow from all
Options +Indexes
</Directory>
ServerName testsite.com
ServerAlias www.testsite.com
like image 573
Rooster242 Avatar asked Oct 21 '22 06:10

Rooster242


1 Answers

i fixed this by adding directive ServerAlias domain.tld *.domain.tld

You can find this for setup under Apache -> Your Virtual Domain settings -> Networking and Addresses -> Alternate virtual server names FIELD.

domain.tld *.domain.tld

like image 100
Serban Avatar answered Oct 24 '22 19:10

Serban