Document Root.

4 posts / 0 new
Last post
#1 Sat, 11/19/2005 - 13:59
FaisalMehmood

Document Root.

Hi.

I have a wierd Problem. I want to set the document root of my machine to a certain folder, but somehow the document root changes to whatever virtual server is added.

What i mean is, if i add a virtual serve xyz.com on the hostname machine (something.machine.com)

something.machine.com pulls up xyz.com

Similarliy if i add a new server abc.com ... now the hostname of the machine something.machine.com pulls up abc.com

... i dont want that to happen. What should i change in apache ? or any other thing ?

Thanks Faisal.

Mon, 11/21/2005 - 07:19
ChrisBlackwell

I believe this happens because Apache uses the first Virtual Host in the config file as the default if the hostname is not recognised.

As a work around add a virtual server for the hostname of the machine, and manually edit the apache directives for that host to include all names used to reference the machine. You can do this through virtualmin or if you don't need to manage the virtualhost, you could just do this directly in the Apache module.

Mon, 11/21/2005 - 14:09
FaisalMehmood

Hmmm

Interesting.

But see, shouldnt all the requests by default go to the default server in the Apache configuration that the installer sets up ?

Faisal.

Mon, 11/21/2005 - 21:20
Joe
Joe's picture

Apache is kind of modal when it comes to virtual hosts...once it is being used for virtual hosting, you no longer have a single Document Root. The last VirtualHost listed in your httpd.conf becomes the "default" (though it is not specified as such in any way), and so you'll want to create a virtual host for something.machine.com to catch those requests (it can have ServerAlias entries for any extra names you'd like the new host to catch).

Note that it doesn't have to be a full-featured Virtualmin domain for things to work (but it can be).

--

Check out the forum guidelines!

Topic locked