0

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?

Zim3r
  • 1,454
  • 5
  • 24
  • 45
  • 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 ``s configured, then their `DocumentRoot`s 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

1 Answers1

5

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.

Shane Madden
  • 114,520
  • 13
  • 181
  • 251