设置一个基本的mod_proxy虚拟主机

我试图build立一个基本的虚拟主机代理所有请求test.local到一个WEBRick服务器我已经运行在127.0.0.1:8080同时保持所有请求本地主机去我的静态文件在/ var / www。 我正在运行Ubuntu 10.04。

我已经安装了libapache2-mod-proxy-html,并且使用了a2enmod代理来启用该模块。 我也有我的虚拟主机启用。 然而,每当我去test.local我总是得到一个神秘的500服务器错误,我所有的日志告诉我是:

[Thu Mar 03 01:43:10 2011] [warn] proxy: No protocol handler was valid for the URL /. If you are using a DSO version of mod_proxy, make sure the proxy submodules are included in the configuration using LoadModule. 

这是我的虚拟主机:

 <VirtualHost test.local:80> LoadModule proxy_module /usr/lib/apache2/modules/mod_proxy.so ServerAdmin webmaster@localhost ServerName test.local ProxyPreserveHost On # prevents this folder from being proxied ProxyPass /static ! DocumentRoot /var/www <Directory /> Options FollowSymLinks AllowOverride None </Directory> <Directory /var/www/> Options Indexes FollowSymLinks MultiViews AllowOverride None Order allow,deny allow from all </Directory> <Proxy *> Order allow,deny Allow from all </Proxy> ProxyPass / http://localhost:8080/ ProxyPassReverse / http://localhost:8080/ ErrorLog /var/log/apache2/error.log # Possible values include: debug, info, notice, warn, error, crit, # alert, emerg. LogLevel warn CustomLog /var/log/apache2/access.log combined 

这里是我的mod_proxy的设置:

 <IfModule mod_proxy.c> #turning ProxyRequests on and allowing proxying from all may allow #spammers to use your proxy to send email. ProxyRequests Off <Proxy *> # default settings #AddDefaultCharset off #Order deny,allow #Deny from all ##Allow from .example.com AddDefaultCharset off Order allow,deny Allow from all </Proxy> # Enable/disable the handling of HTTP/1.1 "Via:" headers. # ("Full" adds the server version; "Block" removes all outgoing Via: headers) # Set to one of: Off | On | Full | Block ProxyVia On </IfModule> 

有人知道我在做什么错吗? 谢谢

看起来你没有加载mod_proxy_http模块(这是需要代理到HTTP服务器)。 我没有Ubuntu 10.04在我面前,但是IIRC是这样的:

 sudo a2enmod proxy_http 

上面的答案对我没有帮助,因为我收到了与作者在所选答案中的评论相同的错误。 但是,我find了下面的post,并改变了解决我的问题:

sudo /usr/sbin/setsebool -P httpd_can_network_connect 1

资料来源: http : //allscm.com/archives/apache2-proxy-disabled-connection-on-localhost.html