Linux - ServerThis forum is for the discussion of Linux Software used in a server related context.
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.
First of all I've looked at "similar threads" without finding an answer. I'm setting up Name-based VH using an IP as the base.
The OS is CentOS 5.4
My config looks like:
NameVirtualHost 12.345.678.90:80
#
# NOTE: NameVirtualHost cannot be used without a port specifier
# (e.g. :80) if mod_ssl is being used, due to the nature of the
# SSL protocol.
#
<Directory "/home/dev1">
Order Deny,Allow
Allow from all
</Directory>
Just did a small test, here are my results:
- Adding the hostname to /etc/hosts works fine, no need to restart anything...
- For testing if the hostname is working, on the Linux Server use 'ping myname',
do not use 'host myname' it didn't work.
- Remember to clear the cache of your browser after making changes to the configuration files.
POV, here's another, easier, option, change all your 12.345.678.90:80 entries to *:80.
1. leave your hosts file as is since it directs your machine to resolve dev1 to your localhost
2. using name based VHs *:80 tells your apache process to listen and read host headers on port 80
3. when your browser hits your apache server it will take dev1 which is presented as a 'host header' to apache and look for the matching ServerName in your VH section and it will server up that content in it.
Thanks to jhcaiced, sandeep.sp and leenucks for their answers. I tried leenucks' approach first because I mean c'mon . . way too simple. I started out using the wildcard instead of the IP so no way it will work. Except . . it did. lol. So thanks again. Oh but I'll keep my doc root first . . . . I like it that way.
-----------------------------
Not quite. It brings up the authentication which means it's finding the right directory but on login it attempts to find dev1/dev1 and of course gives a 404 error.
Thanks to jhcaiced, sandeep.sp and leenucks for their answers. I tried leenucks' approach first because I mean c'mon . . way too simple. I started out using the wildcard instead of the IP so no way it will work. Except . . it did. lol. So thanks again. Oh but I'll keep my doc root first . . . . I like it that way.
-----------------------------
Not quite. It brings up the authentication which means it's finding the right directory but on login it attempts to find dev1/dev1 and of course gives a 404 error.
if you're trying to make this harder for yourself, have at it.. :-). wildcards work very well... there are a few instances were you don't want wildcard but generally it makes migrations and setting up new non-ssl sites much easier.. best of luck..
if you're trying to make this harder for yourself, have at it.. :-). wildcards work very well... there are a few instances were you don't want wildcard but generally it makes migrations and setting up new non-ssl sites much easier.. best of luck..
Lol. I think you missed the point of my post which is "it worked." I was describing my initial reaction to your suggestion. But yeah the wildcards are it. Thanks again.
The problem now is that it calls a non-existent directory
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.