我正在尝试设置一个基本的虚拟主机,将所有请求test.local代理到我在127.0.0.1:8080上运行的WEBrick服务器,同时保持对localhost的所有请求转到/ 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它是这样的:
原文链接:https://www.f2er.com/ubuntu/348739.htmlsudo a2enmod proxy_http