用于端口转发的Apache vhostconfiguration

我正在尝试在Apache中获得反向代理function。 我正在使用Windows Server 2012上的Bitnami RubyStack。以下configuration使Apache甚至无法启动 – error.log似乎没有任何问题。

<VirtualHost *:80> ServerName mydomain.nl ServerAlias mysub.mydomain.nl # this is a Rails application DocumentRoot "C:/Bitnami/rubystack-2.0.0-17/projects/dummy" RewriteEngine On <Proxy balancer://thinservers> BalancerMember http://127.0.0.1:3001 </Proxy> # Redirect all non-static requests to thin RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_FILENAME} !-f RewriteRule ^/(.*)$ balancer://thinservers%{REQUEST_URI} [P,QSA,L] # Custom log file locations ErrorLog "C:/Bitnami/rubystack-2.0.0-17/projects/dummy/log/error.log" CustomLog "C:/Bitnami/rubystack-2.0.0-17/projects/dummy/log/access.log" </VirtualHost> 

我想要实现的是将端口80上的传入请求转发到3001.我认为可能有问题,因为Bitnami文档根目录也被configuration。

我在Apache中并不舒服。 我已经包含了我需要的代理function的模块。 只要我不包括虚拟主机,Apache就会正常启动。 然而,我不知道重写和平衡成员应该做什么。

编辑 :经过一些权限检查,我得到了Apache启动,但是当访问端口80时,我得到一个内部服务器错误。

没有协议处理程序是有效的URL /。 如果您正在使用mod_proxy的DSO版本,请确保代理子模块包含在使用LoadModule的configuration中。

经过一番挖掘,我find了一些类似的东西,只是指甲。 我发现了一些晦涩难懂的教程,甚至是Apache文档部分的错误链接。 所以,对于那些真的不在意Apache的人来说,只是希望他们的Rails应用能够在Bitnami Rubystack上使用反向代理。

在主configuration文件(httpd-conf)中包含虚拟主机在extra / vhosts.conf中添加自定义虚拟主机条目

 NameVirtualHost *:80 <VirtualHost *:80> DocumentRoot "YOUR_BITNAMI_INSTALL_DIR/rubystack-2.0.0-17/projects/dummy/public" ServerName your-subdomain.domain.com ProxyPass / http://localhost:3001/ ProxyPassReverse / http://localhost:3001/ </VirtualHost> 

完美的技巧!