简体   繁体   English

Apache:具有[PHP | Python | Ruby]支持的VirtualHost

[英]Apache: VirtualHost with [PHP|Python|Ruby] support

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: 我正在尝试几种语言(Python,Ruby ...),我想知道是否有一种方法可以优化我的Apache服务器以某些 VirtualHost中加载某些模块,例如:

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

Thanks. 谢谢。

Each Apache worker loads every module, so it's not possible to do within Apache itself. 每个Apache工作者都加载每个模块,因此不可能在Apache本身内完成。

What you need to do is move your language modules to processes external to Apache workers. 您需要做的是将语言模块移至Apache worker外部的进程。

This is done for your languages with the following modules: 使用以下模块针对您的语言完成此操作:

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? 因此,如果仅加载了python,那么当需要为ruby服务时会发生什么呢?
  2. For reason 1, certain directives are web server only, and not virtualhost specific. 由于原因1,某些指令仅是Web服务器,而不是特定于virtualhost的。 MaxRequestsPerChild, LoadModule etc are such. MaxRequestsPerChild,LoadModule等都是这样。

I think the only way is to have a "proxy" web server that dispatches requests to the real servers ... 我认为唯一的方法是拥有一个“代理” Web服务器,该服务器将请求分发到真实服务器...

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 有N台真实服务器,每台服务器都有特定的配置并支持并加载了一种语言……每台服务器当然会在不同的端口上侦听,最终只会在回送设备上侦听

Apache mod_proxy should do the job Apache mod_proxy应该做的

My 2 cents 我的2美分

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. 我的想法是几个apache进程(每个进程具有不同的配置),它们侦听不同的地址和/或端口,并在前面重定向到相应服务器的http代理(squid或apache)。 This has a possible added advantage of caching. 这可能具有缓存的附加优点。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM