For Programmers: Free Programming Magazines  


Home > Archive > PHP Language > January 2006 > Redirect port on Apache. Local network. Novice









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Redirect port on Apache. Local network. Novice
msch

2005-12-17, 6:57 pm

Hi,

This is a simple question from a novice. 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. I
created two IP addresses on the host's NIC. (Pinging is ok.)

I would like to address each appl. as 'www.app1.loc' and
'www.app2.loc'. The HOST file was modified as follows:
192.168.100.1 app1.loc www.app1.loc
192.168.100.10 app2.loc www.app2.loc

If I type 'http://www.app1.loc'/app1, app1 pops up. The second app runs
only if the URL is specified as: 'http://localhost:81/app2' or
'http://www.app2.loc:81/app2'.

I understand that apache defaults to port 80. Since the two servers
must run at the same time, how can I configure the second apache server
to listen to port 81 w/o explictely mentioning it in the URL address ie
'http://www.app2.loc/app2'?

Thanks for any advice,

Mark

The virtual host defs are included below.

Listen 192.168.100.10:81
<VirtualHost 192.168.100.10:81>
ServerName app2.loc:81
ServerAlias www*.www.app2.loc
DocumentRoot "C:/Program Files/vtigerCRM4_2/apache/htdocs"
<Directory "C:/Program Files/vtigerCRM4_2/apache/htdocs">
Options Indexes FollowSymLinks +Includes +ExecCGI
AllowOverride None
Order allow,deny
Allow from all
</Directory>
</VirtualHost>

Colin McKinnon

2006-01-10, 4:00 am

msch wrote:

> This is a simple question from a novice.


Obviously - since its nothing to do with PHP.

> I would like to address each appl. as 'www.app1.loc' and
> 'www.app2.loc'. The HOST file was modified as follows:
> 192.168.100.1 app1.loc www.app1.loc
> 192.168.100.10 app2.loc www.app2.loc
>

<snip>

> The virtual host defs are included below.
>
> Listen 192.168.100.10:81
> <VirtualHost 192.168.100.10:81>
> ServerName app2.loc:81
> ServerAlias www*.www.app2.loc
> DocumentRoot "C:/Program Files/vtigerCRM4_2/apache/htdocs"
> <Directory "C:/Program Files/vtigerCRM4_2/apache/htdocs">
> Options Indexes FollowSymLinks +Includes +ExecCGI
> AllowOverride None
> Order allow,deny
> Allow from all
> </Directory>
> </VirtualHost>


I've ever used apache on MS-Windows, but for any normal OS...
Instead of specifying the port to bind - try specifying the address.

C.
'Dungeon' Dave

2006-01-25, 6:57 pm

... and it came to pass that msch <msch-prv@bluewin.ch> uttered forth:
>
>I understand that apache defaults to port 80. Since the two servers
>must run at the same time, how can I configure the second apache server
>to listen to port 81 w/o explictely mentioning it in the URL address ie
>'http://www.app2.loc/app2'?


You'll need to set up a virtual host for www.app2.loc that redirects to
port81.

The problem isn't apache - it's the browser. If you do not specify the
port number, it ss out port80.

nb: an alternative is to have both hosts on 80 but use virtual hosting
to separate out the webroot content - is there some reason for having
one site on port 81?
--

"Dungeon" Dave
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com