Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

When I try to access DocumentRoot it redirects to one of my VirtualHosts, I can't see contents in /var/www/html.

It's under Virtualmin 3.94 and I think someone else my problem here, but I can't find the options he tried to fix.

How can I fix this please?

share|improve this question

closed as not a real question by Michael Hampton, Scott Pack, Ward, Magellan, rnxrx Oct 14 '12 at 7:03

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.If this question can be reworded to fit the rules in the help center, please edit the question.

Can you clarify what you're expecting to see, what you're seeing instead, and how your system is configured? Which DocumentRoot are you accessing, and how are you doing it? If you mean you're trying to access the main server config's DocumentRoot and you have <VirtualHost>s configured, then their DocumentRoots override that of the main config. – Shane Madden Oct 13 '12 at 21:15
Thanks, I expect to see Apache Default Page, but I see one of my VirtualHosts instead. my DocumentRoot is set to /var/www/html and I'm accessing it through browser by typing my server's IP. (also edited my question) – Zim3r Oct 13 '12 at 21:20
up vote 5 down vote accepted

When you have virtual hosts configured on a port, one of them will always serve a request for that port - the main server isn't used anymore, a request that doesn't match the ServerName or ServerAlias of a <VirtualHost> will get sent to the first <VirtualHost> on the port. The only way the DocumentRoot that you've defined globally will be used at all is if the <VirtualHost> that handles a request doesn't define its own DocumentRoot.

From the documentation:

Main host goes away

If you are adding virtual hosts to an existing web server, you must also create a <VirtualHost> block for the existing host. The ServerName and DocumentRoot included in this virtual host should be the same as the global ServerName and DocumentRoot. List this virtual host first in the configuration file so that it will act as the default host.

Set yourself up a <VirtualHost> to handle the requests that you're trying to send to the main server's DocumentRoot - if you're accessing it by IP, just set the vhost to have a ServerName of that IP address.

share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.