Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Virtual server / redirection

Status
Not open for further replies.

Ahgil12

Technical User
Apr 14, 2012
4
0
0
US
In apache, is it possible to set up virtual web server, then based on a host name with a context root and apache will direct the incoming request to an instance? For example,

Virtual host 1 for host/app1, which apache will direct all incoming request to


Virtual host 2 for host/app2, which apache will direct all incoming request to

If not possible to do, what is the way?
 
A reverse proxy may work for you.

other than that, simply have a 0sec meta refresh
Code:
<meta http-equiv="refresh" content="0;url=http://www.hostname.com:82">
or with PHP
Code:
header('Location: [URL unfurl="true"]http://www.hostname.com:82')[/URL]
redirect on the directory index page.


Chris.

Indifference will be the downfall of mankind, but who cares?
Time flies like an arrow, however, fruit flies like a banana.
Webmaster Forum
 
Thanks for the quick reply.

Regarding the reverse-proxy, server has only 1 port open - 80. Then i want that one url ( to have a root context, so:

will direct requests to the app1 instance listening on port 81.

will direct requests to the app2 instance listening on port 82.

How do I do this?
 
So if only port 80 is open, how are other services listening on 81 & 82?

Or do you mean that only port 80 is open through a firewall?

Chris.

Indifference will be the downfall of mankind, but who cares?
Time flies like an arrow, however, fruit flies like a banana.
Webmaster Forum
 
Another possible solution has sprung to mind, that of using frames.

Chris.

Indifference will be the downfall of mankind, but who cares?
Time flies like an arrow, however, fruit flies like a banana.
Webmaster Forum
 
take a look at the Rewrite Rule this may be an option

Laurie.
 
So, the reverse proxy should work perfectly well, as the external request is made TO the HTTP port (80) but the content is being proxied from an internal IP and port.


Redirects and rewrites of course will not work in this case.

Chris.

Indifference will be the downfall of mankind, but who cares?
Time flies like an arrow, however, fruit flies like a banana.
Webmaster Forum
 
Can u please clarify how the proxy reverse work? I don't think the host name inside each virtual server can understand the host name plus the context root.
 
A proxy is aimply something that performs a service on your behalf. A reverse proxy is ... and referencing Wikipedia will save a whole lot of typing.

I don't think the host name inside each virtual server can understand the host name plus the context root.

Correct, which is why you would normally use the internal IP and port of the server/machine you are proxying the content from, or for.

A HTTP request goes to the proxy then requests the output stream from nnn.nnn.nnn.nnn:pORT and spits it out via port 80.


Chris.

Indifference will be the downfall of mankind, but who cares?
Time flies like an arrow, however, fruit flies like a banana.
Webmaster Forum
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top