Newbie. Drop port number from IP address

Newbie. Drop port number from IP address

am 17.12.2005 22:23:27 von msch

Hello,

My apologies for asking this trivial question (I am a newbie). I have
two PHP applications requiring distinct Apache versions to run. The
apps are hosted on the same XP machine, one running on default port 80,
the other on 81.

The IP-names of each appl. are 'www.app1.loc' and 'www.app2.loc'. The
HOST file was modified as shown (Both IP addresses share the same NIC):
192.168.100.1 app1.loc www.app1.loc
192.168.100.10 app2.loc www.app2.loc

The apps run fine when the IP addresses are typed in as follows:
http://www.app1.loc/app1
http://www.app2.loc:81/app2.

Question: How can I drop the port number reference to call up the
second app (ie. 'http://www.app2.loc/app2')? Is it possible?

Thanks for any advice,

Mark


Vrtual host definiton:

Listen 192.168.100.10:81

ServerName app2.loc:81
ServerAlias www*.www.app2.loc
DocumentRoot "C:/Program Files/vtigerCRM4_2/apache/htdocs"

Options Indexes FollowSymLinks +Includes +ExecCGI
AllowOverride None
Order allow,deny
Allow from all

Re: Newbie. Drop port number from IP address

am 17.12.2005 22:46:28 von ge0rge

msch wrote:
> Hello,
>
> My apologies for asking this trivial question (I am a newbie). I have
> two PHP applications requiring distinct Apache versions to run. The
> apps are hosted on the same XP machine, one running on default port 80,
> the other on 81.
>
> The IP-names of each appl. are 'www.app1.loc' and 'www.app2.loc'. The
> HOST file was modified as shown (Both IP addresses share the same NIC):
> 192.168.100.1 app1.loc www.app1.loc
> 192.168.100.10 app2.loc www.app2.loc
>
> The apps run fine when the IP addresses are typed in as follows:
> http://www.app1.loc/app1
> http://www.app2.loc:81/app2.
>
> Question: How can I drop the port number reference to call up the
> second app (ie. 'http://www.app2.loc/app2')? Is it possible?

no ... unless you change your host file to make app2 requests go to the
first Apache (port 80) and reconfigure the httpd.conf of that Apache to
redirect all /app2 requests to the app2 apache (on whatever port that
instance is listening).

--
Women give to men the very gold of their lives. Possibly; but they
invariably want it back in such very small change.
-- Oscar Wilde

Re: Newbie. Drop port number from IP address

am 18.12.2005 01:36:14 von msch

ge0rge,

Thanks for the quick feedback. Any hints/links on how to accomplish
that?

msch

ge0rge wrote:
> msch wrote:
> > Hello,
> >
> > My apologies for asking this trivial question (I am a newbie). I have
> > two PHP applications requiring distinct Apache versions to run. The
> > apps are hosted on the same XP machine, one running on default port 80,
> > the other on 81.
> >
> > The IP-names of each appl. are 'www.app1.loc' and 'www.app2.loc'. The
> > HOST file was modified as shown (Both IP addresses share the same NIC):
> > 192.168.100.1 app1.loc www.app1.loc
> > 192.168.100.10 app2.loc www.app2.loc
> >
> > The apps run fine when the IP addresses are typed in as follows:
> > http://www.app1.loc/app1
> > http://www.app2.loc:81/app2.
> >
> > Question: How can I drop the port number reference to call up the
> > second app (ie. 'http://www.app2.loc/app2')? Is it possible?
>
> no ... unless you change your host file to make app2 requests go to the
> first Apache (port 80) and reconfigure the httpd.conf of that Apache to
> redirect all /app2 requests to the app2 apache (on whatever port that
> instance is listening).
>
> --
> Women give to men the very gold of their lives. Possibly; but they
> invariably want it back in such very small change.
> -- Oscar Wilde

Re: Newbie. Drop port number from IP address

am 18.12.2005 02:22:08 von ge0rge

msch wrote:
> ge0rge,
>
> Thanks for the quick feedback. Any hints/links on how to accomplish
> that?
....
So assuming this is your hosts file
192.168.100.1 app1.loc www.app1.loc
192.168.100.10 app2.loc www.app2.loc

In the httpd.conf file you would have a Redirect directive eg.
Redirect permanent /app2 http://www.app2.loc:81/
which will result in request for http://www.app1.loc/app2/test.htm to be
redirected to http://www.app2.loc:81/test.htm
Of course you can still go directly to www.app2.loc:81
You should also checkout the RedirectMatch directive. Both of these
directives require the mod_alias module to be enabled.

For more complex URL manipulation, there is also the mod_rewrite module.

You can check all these directives at the apache site
http://httpd.apache.org/docs/2.0/
http://httpd.apache.org/docs/2.0/mod/quickreference.html
http://httpd.apache.org/docs/2.0/mod/mod_alias.html#redirect

--
Of all forms of caution, caution in love is the most fatal.