views:

445

answers:

5

Hi there, I am experimenting with several languages (Python, Ruby...), and I would like to know if there is a way to optimize my Apache Server to load certain modules only in certain VirtualHost, for instance:

http://myapp1 <- just with Ruby support 
http://myapp2 <- just with Python support
http://myapp3 <- just with Php support
...

Thanks.

A: 

Read this Link Virtual Host

joe
A: 

I dont think thats possible as,

  1. The same thread/forked process might be serving pages from different Virtualhosts. So if it has loaded only python, what happens when it needs to serve ruby?
  2. For reason 1, certain directives are web server only, and not virtualhost specific. MaxRequestsPerChild, LoadModule etc are such.
uswaretech
+3  A: 

Each Apache worker loads every module, so it's not possible to do within Apache itself.

What you need to do is move your language modules to processes external to Apache workers.

This is done for your languages with the following modules:

Van Gale
A: 

I think the only way is to have a "proxy" web server that dispatches requests to the real servers ...

The proxy server has a list of domain names -> Server Side language, and does nothing else but transparently redirecting to the correct real server

There are N real server, each one with a specific configuration and a single language supported and loaded ... each server will listen on a different port of course and eventually only on the loopback device

Apache mod_proxy should do the job

My 2 cents

AlberT
A: 

My Idea is several apache processes (each one with different config) listening on different addresses and/or ports and a http proxy (squid or apache) in the front redirecting to respective server. This has a possible added advantage of caching.