我已经从我在apache 2.2手册中读到的内容相应地configuration了我的apache。 以下面的例子作为我的configuration。
ProxyRequests Off <Proxy *> Order deny,allow Allow from all </Proxy> ProxyPass "/home/kwokfu/sandbox" "http://localhost:8080/sandbox" ProxyPassReverse "/home/kwokfu/sandbox" "http://localhost:8080/sandbox"
每次访问http://localhost:8080/sandbox ,服务器仍然指向我的本地主机的默认文档根目录,而不是我在代理configuration中指出的那个目录。
我不知道我在这里做错了什么,任何帮助真的很感激!
作为参考,我编译我的代理模块如下:
$ apxs -cia mod_proxy.c proxy_util.c $ apxs -cia mod_proxy_http.c $ apachectl -M ... proxy_module (shared) proxy_http_module (shared) ...
并且每次访问http://localhost:8080/sandbox都会得到以下日志消息:
"GET /sandbox HTTP/1.1" 404 206 "-" "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.0.13) Gecko/2009080315 Ubuntu/9.04 (jaunty) Firefox/3.0.13" ... [debug] proxy_util.c(1806): proxy: grabbed scoreboard slot 0 in child 11225 for worker http://localhost:8080/sandbox [debug] proxy_util.c(1825): proxy: worker http://localhost:8080/sandbox already initialized [debug] proxy_util.c(1922): proxy: initialized single connection worker 0 in child 11225 for (localhost) [debug] proxy_util.c(1806): proxy: grabbed scoreboard slot 1 in child 11225 for worker proxy:reverse [debug] proxy_util.c(1825): proxy: worker proxy:reverse already initialized [debug] proxy_util.c(1922): proxy: initialized single connection worker 1 in child 11225 for (*) [debug] proxy_util.c(1791): proxy: worker http://localhost:8080/sandbox already initialized [debug] proxy_util.c(1791): proxy: worker http://localhost:8080/sandbox already initialized ... [error] [client 127.0.0.1] File does not exist: /opt/apache2/2.2.12/htdocs/sandbox ...
似乎代理不工作…这让我疯狂…
从你的描述我认为你应该有以下几点:
ProxyPass "/sandbox" "http://localhost:8080/home/kwokfu/sandbox" ProxyPassReverse "/sandbox" "http://localhost:8080/home/kwokfu/sandbox"
您正在访问错误的URI。 您应该访问http:// localhost / sandbox ,然后代理Apache实例应该将请求指向侦听端口8080的实例。当然,该实例也将被configuration。 你为这个虚拟主机设置了一个DocumentRoot吗?