Apache: Allowing IP Access and NameVirtualHost concurrently
Hi guys,
I have always been using NameVirtualHost to manage multiple domains on one machine. But, for a clean httpd.conf (no namevirtualhost specified), any access to the server will default to DocumentRoot yah? But I realise I can't do that if NameVirtualHost is enabled. Anyway to allow both way of access? |
I don't understand what your saying. I don't think the absense of a line "NameVirtualHost" makes httpd.conf all that much cleaner, but that's your call.
I have no trouble configuring Apache for both Virtual Hosting and also have a default DocumentRoot. I think that's what you're asking how to do. The first virtual host is your default host. Here's some cut/paste snippets from my httpd.conf showing bits and pieces of the setup. You can hit the three different hosts shown below like this (you can also hit one of the virtual host's files via the default host, I laid things out that way on purpose): Code:
http://myhostname.domain.com Code:
NameVirtualHost *:80 |
i'm sorry i am not clear enough. perhaps it is my lack of understanding on this issue - my apologies
What i'm looking at is to access the server via its IP (say http://192.168.1.10) since we are still testing it. By accessing the server by that default IP, if there's nothing mentioned for DocumentRoot, it will show the Apache Test Page yah? Let's say DocumentRoot in this case is /home/user I then point beta.domain.com to it using NameVirtualHost (why am I doing this is because the actual domain.com is still pointing to another old server, doing migrating). For this DocumentRoot, it will be in /home/user/beta In this /home/user, there are other folders like /home/user/sql (phpMyAdmin), /home/user/other so my question is: am I able to configure it such that I can access the server using the name (NameVirtualHost) http://beta.domain.com AND using the IP, http://192.168.1.10 and thus I can also access the other folders via http://192.168.1.10/sql etc... |
As haertig said, set up your first NameVirtualHost to point to /home/user. Then any access will default to this host. Also, if there is no valid DocumentRoot, Apache will spit out an error, not the test page. (You haven't pointed it to the test page).
|
ah.. i got it to work already.. many thanks for the pointers!
|
All times are GMT -5. The time now is 05:09 AM. |