You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by John Steel <jo...@phonewebcam.com> on 2007/04/29 14:04:00 UTC

[users@httpd] Setting up a staging server with apache

I'm new to PHP but not J2EE. In J2EE you can set the container to 
resolve separate apps based off their hostname as long as you set them 
up as web-apps in the config.
So for example, you can on a single PC visit 
http://localhost:8080/www.example1.com and 
http://localhost:8080/www.example2.com. What you are really doing is 
just qualifying 1 host having multiple web-apps. Its useful because you 
can expose this PC to the web as a staging server, and outside users can 
see them by using URL's like 
http://staging.example.com:8080/www.example1.com and 
http://staging.example.com:8080/www.example2.com. This is all handled 
entirely by the J2EE server. When you want to populate production 
machines you copy the staging content to live, where the real URL is 
mapped appropriately.

I am trying to reproduce this setup for PHP development which will 
manage separate hosts running separate apps (Drupal, MediaWiki, etc).
If I try to use Apache VirtualHosts I get stuck - I know I could set up 
www.example1.com and www.example2.com as separate entries but that means 
messing externally with with the IP addresses/hostnames. Is this 
possible with a rewrite rule? I.e., if you see 
http://localhost:8010/{$hostname} you really mean ServerName={$hostname} 
in httpd.conf?
Any smarter solutions very welcome, thanks.

-- 
--------------------------
http://www.phonewebcam.com
john.steel@phonewebcam.com


---------------------------------------------------------------------
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] Setting up a staging server with apache

Posted by Joshua Slive <jo...@slive.ca>.
On 4/29/07, John Steel <jo...@phonewebcam.com> wrote:

> I am trying to reproduce this setup for PHP development which will
> manage separate hosts running separate apps (Drupal, MediaWiki, etc).
> If I try to use Apache VirtualHosts I get stuck - I know I could set up
> www.example1.com and www.example2.com as separate entries but that means
> messing externally with with the IP addresses/hostnames. Is this
> possible with a rewrite rule? I.e., if you see
> http://localhost:8010/{$hostname} you really mean ServerName={$hostname}
> in httpd.conf?
> Any smarter solutions very welcome, thanks.

Just put the php apps in separate directories under your DocumentRoot.
No need for several virtual hosts. The only hitch could be if the apps
make assumptions about being able to use absolute URLs (starting in
/).

An alternative is port-based virtual hosts with a reverse proxy and
possibly mod_proxy_html to correct links. (Put each webapp on a
high-numbered port, and then use ProxyPass and ProxyPassReverse on
port 80 to pass requests back to the webapps.)

Joshua.

---------------------------------------------------------------------
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