Welcome to WebmasterWorld Guest from 54.197.116.116

Forum Moderators: bakedjake

Message Too Old, No Replies

Apache Virtual Hosting Question

how to view a virtual host before dns propagates

   
7:54 pm on Feb 9, 2003 (gmt 0)

10+ Year Member



Hi all,
First let me apologixe if this is in the wrong forum. I have ben searching for hours and cant seem to find the answer to this one.

I have a linux / apache box with currently 3 ip's assigned to it.
I am using one ip as a virtual server to serve more than one site.
My question is how do I view site 2 before the dns changes propagate?

Here's my config for site 2
(names changed to protect the innocent)
********************************************************
<VirtualHost 111.111.11.11>
DocumentRoot "/home/sites/www.lamedomain.com/web"
ServerName lamedomain.com
ServerPath /www.lamedomain.com/
ServerAdmin info@lamedomain.com
ScriptAlias /cgi-bin/ /home/sites/www.lamedomain.com/cgi-bin/
ErrorLog /home/sites/www.lamedomain.com/logs/error_log
TransferLog /home/sites/www.lamedomain.com/logs/access_log
LogFormat "combined"
<Directory "/home/sites/www.lamedomain.com">
AllowOverride all
</Directory>
ServerAlias lamedomain.com
</VirtualHost>
*******************************************************
I know theres some way to do it as I have viewed virtual sites before with something like ipaddress/~virtualsite/ but cant find any examples or info on making it work.
Any and all help is appreciated.
Thanks

8:05 pm on Feb 9, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Welcome to WebmasterWorld [webmasterworld.com] Phoenix.

Be sure to read Marcia`s WebmasterWorld Welcome and Guide to the Basics [webmasterworld.com] post.

To view the page from a certain computer you could just add a new entry to that computerīs

/etc/hosts
or
%SystemRoot%\system32\drivers\etc\hosts
file.

ipaddr name

To view the virtual host using ipaddress/~virtualsite/ you need to map virtualsiteīs DocumentRoot [httpd.apache.org] to that URI.

Andreas

8:40 pm on Feb 9, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Or you could add this to the httpd.conf above all the virtual hosts:
AliasMatch ^/domain/([^/]+)(/(.*))? /home/sites/$1/web/$3

Then use this to get you there:
[your_ip...]

This is a set up once and forget - will work will any future domains you set up.

You can replace the word 'domain' with anything you want, just know that no one will be able to use a directory with that name on their own sites.

8:42 pm on Feb 9, 2003 (gmt 0)

10+ Year Member



Thanks for the welcome.

I really dont get what you are saying or maybe its not that you understood what I said?
As you can see by the config it is maped correctly, and yes its added to the dns on that machine. The question was / is

How do I view that site before the changes have propagated throught the internet, IE: I changed name servers and would like to see the site on the new server without assigning it a ip address of its own?

8:54 pm on Feb 9, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



The hosts file entry is necessary to help the computer that you are using to view the new site from to resolve www.lamedomain.com to the ip address 111.111.11.11. Since you just changed name servers that info is not available by querying a name server. So the resolver will have to use the entries in your hosts file instead.

The mapping I was referring to will be only necessary when you want to view your virtualhost as a directory from the main domain. jamesa provided an example of how to achieve this mapping.

HTH Andreas

9:03 pm on Feb 9, 2003 (gmt 0)

10+ Year Member



THANKS jamesa!

That was exactly what I was looking for!
Like I said I seen it before and havent ben able to find it again, this time its going into my little black book.

Thanks again.

9:06 pm on Feb 9, 2003 (gmt 0)

10+ Year Member



PS: jamesa wouldnt happen to be a raq guru also would you? I have one that needs a friend (help).
Dead admin server........
11:05 pm on Feb 9, 2003 (gmt 0)

10+ Year Member



My question is how do I view site 2 before the dns changes propagate?

In a sense, the DNS changes have already propagated. If you telnet to your server and ping the newly added domain, you'll certainly see the expected results. The change just may not have propagated far enough for your "usual" named server to see them yet. The easy solution, then, is to change your usual named server.

When you connect to the Internet through your ISP, you're using their named servers (typically set to auto-assign). In your connection setup, which is a little different for each OS, simply change it from auto-assign to YOUR named servers. When you reconnect, you'll be getting all your DNS information from a server where the changes HAVE propagated (and did so instantly).