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

Sev*_*ies 11 ubuntu mod-proxy apache-2.2

我正在尝试设置一个基本的虚拟主机,以将所有对 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.
Run Code Online (Sandbox Code Playgroud)

这是我的虚拟主机:

<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
Run Code Online (Sandbox Code Playgroud)

这是我对 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>
Run Code Online (Sandbox Code Playgroud)

有谁知道我做错了什么?谢谢

nic*_*rim 35

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

sudo a2enmod proxy_http
Run Code Online (Sandbox Code Playgroud)