You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Todd <to...@castaweb.com> on 2004/06/11 15:58:49 UTC

[users@httpd] can I resolve vhost to ip + port

Just curious: Is there a way to browse a vhost using just the IP address
and perhaps a port? This must be a common issue. I'm redesigning a
website and plan to host it on a different system than where the site
currently lives. I've set up a vhost on the new system so I can start
putting together the new site, including all the pages, the database and
CMS I'll be using. Naturally, I can't change the DNS to point to this
new site until its ready to go live, but I'd like to be able to browse
the work in development. 

The following example in the documentation looks potentially applicable
-- enough for me to give it a try -- but I'm not certain and thought
this may be a common issue for many. I couldn't pinpoint an answer in
the archives, so I apologize if it's a topic frequently covered. 

<VirtualHost _default_:80>
DocumentRoot /www/default
...
</VirtualHost>

Any suggestions would be greatly appreciated. Thanks.

Todd



---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


RE: [users@httpd] can I resolve vhost to ip + port

Posted by Todd <to...@castaweb.com>.
That's a good suggestion, Tim. It didn't even cross my mind.
Unfortunately, I don't have access to the DNS server on this one, but I
have another site I want to move as well and I do have access to that
DNS server. 

Thanks, Todd


-----Original Message-----
From: Tim Johnson [mailto:asfml@eggserver.tallships.ca] 
Sent: Friday, June 11, 2004 12:57 PM
To: users@httpd.apache.org; Robert Andersson
Subject: Re: [users@httpd] can I resolve vhost to ip + port

Quoting Robert Andersson <ro...@profundis.nu>:

> Todd wrote:
> > 1. I should have mentioned that I have two IPs -- one as the main
> > server IP and another "shared" IP that I'd like to use for several
vhosts,
> > including the one I'm working on. So now I'm thinking this won't
work,
> > right?
>
> Uhm... I suppose it should work, if you do it right. I'm not
absolutely
> clear on how you want it to work, so I cannot give detailed
instructions.
>
> > 2. I did read up a little on "name-based" vhosts versus old-style
> > vhosting. Can you use both at the same time should you need to?
>
> Yes, but it can get confusing. You can assign one IP/port-pair to each
such
> vhost, and then use one for several namebased vhosts.
>
> > 3. Finally, with the example below, would I also include
> > "DocumentRoot /www/desired_directory?"
>
> Yes, it was a very simplified example.
>
> Remember to also make Apache listen to any IP and port that you are
using.
> You didn't say if you had Apache 1.3 or 2.0, but at least for the
latter,
> see:
>     http://httpd.apache.org/docs-2.0/mod/mpm_common.html#listen
>
> Regards,
> Robert Andersson
>

If you have access to the DNS server (you mentioned you didn't want to
change it
yet, but if not setting yous hosts file may get you by) just create a
new entry,
like www2.domain and set your virthost in the config. Quite simple to
change
back when you're ready. Unless I totally mis-understood what you want to
do...



---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server
Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org





---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] can I resolve vhost to ip + port

Posted by Tim Johnson <as...@eggserver.tallships.ca>.
Quoting Robert Andersson <ro...@profundis.nu>:

> Todd wrote:
> > 1. I should have mentioned that I have two IPs -- one as the main
> > server IP and another "shared" IP that I'd like to use for several vhosts,
> > including the one I'm working on. So now I'm thinking this won't work,
> > right?
>
> Uhm... I suppose it should work, if you do it right. I'm not absolutely
> clear on how you want it to work, so I cannot give detailed instructions.
>
> > 2. I did read up a little on "name-based" vhosts versus old-style
> > vhosting. Can you use both at the same time should you need to?
>
> Yes, but it can get confusing. You can assign one IP/port-pair to each such
> vhost, and then use one for several namebased vhosts.
>
> > 3. Finally, with the example below, would I also include
> > "DocumentRoot /www/desired_directory?"
>
> Yes, it was a very simplified example.
>
> Remember to also make Apache listen to any IP and port that you are using.
> You didn't say if you had Apache 1.3 or 2.0, but at least for the latter,
> see:
>     http://httpd.apache.org/docs-2.0/mod/mpm_common.html#listen
>
> Regards,
> Robert Andersson
>

If you have access to the DNS server (you mentioned you didn't want to change it
yet, but if not setting yous hosts file may get you by) just create a new entry,
like www2.domain and set your virthost in the config. Quite simple to change
back when you're ready. Unless I totally mis-understood what you want to do...



---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] can I resolve vhost to ip + port

Posted by Robert Andersson <ro...@profundis.nu>.
Todd wrote:
> 1. I should have mentioned that I have two IPs -- one as the main
> server IP and another "shared" IP that I'd like to use for several vhosts,
> including the one I'm working on. So now I'm thinking this won't work,
> right?

Uhm... I suppose it should work, if you do it right. I'm not absolutely
clear on how you want it to work, so I cannot give detailed instructions.

> 2. I did read up a little on "name-based" vhosts versus old-style
> vhosting. Can you use both at the same time should you need to?

Yes, but it can get confusing. You can assign one IP/port-pair to each such
vhost, and then use one for several namebased vhosts.

> 3. Finally, with the example below, would I also include
> "DocumentRoot /www/desired_directory?"

Yes, it was a very simplified example.

Remember to also make Apache listen to any IP and port that you are using.
You didn't say if you had Apache 1.3 or 2.0, but at least for the latter,
see:
    http://httpd.apache.org/docs-2.0/mod/mpm_common.html#listen

Regards,
Robert Andersson


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


RE: [users@httpd] can I resolve vhost to ip + port

Posted by Todd <to...@castaweb.com>.
Thanks for your feedback. It raises a couple issues. 

1. I should have mentioned that I have two IPs -- one as the main server
IP and another "shared" IP that I'd like to use for several vhosts,
including the one I'm working on. So now I'm thinking this won't work,
right? I suppose I could use the main, exclusive IP address as temporary
placeholder for projects like this. It actually doesn't have a domain
name associated with it at this point. 

2. I did read up a little on "name-based" vhosts versus old-style
vhosting. Can you use both at the same time should you need to? 

3. Finally, with the example below, would I also include "DocumentRoot
/www/desired_directory?" 


-----Original Message-----
From: Robert Andersson [mailto:robert@profundis.nu] 
Sent: Friday, June 11, 2004 9:05 AM
To: users@httpd.apache.org
Subject: Re: [users@httpd] can I resolve vhost to ip + port

Todd
> Just curious: Is there a way to browse a vhost using just the IP
> address and perhaps a port?

Yes. Of course, you cannot use *name-based* vhosts using just the
IP/port,
by definition. You can, however, use old-style vhosting by giving each
vhost
its own IP/port combination.

    <VirtualHost *:80>
        ServerName test1
    </VirtualHost>

    <VirtualHost *:81>
        ServerName test1
    </VirtualHost>

    etc...

Regards,
Robert Andersson


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server
Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org





---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] can I resolve vhost to ip + port

Posted by Robert Andersson <ro...@profundis.nu>.
Todd
> Just curious: Is there a way to browse a vhost using just the IP
> address and perhaps a port?

Yes. Of course, you cannot use *name-based* vhosts using just the IP/port,
by definition. You can, however, use old-style vhosting by giving each vhost
its own IP/port combination.

    <VirtualHost *:80>
        ServerName test1
    </VirtualHost>

    <VirtualHost *:81>
        ServerName test1
    </VirtualHost>

    etc...

Regards,
Robert Andersson


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org