Apache: Allowing IP Access and NameVirtualHost concurrently
Linux - GeneralThis Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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):
Note: I cut/pasted my httpd.conf snippets and manually edited to generalize things. Hopefully I didn't make any typos in that manual editing, but I certainly could have. Use as an example only.
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
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).
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.