我正在使用Tomcat 6.0.18上运行的Web应用程序,并将Apache 2用作反向代理。这工作正常。我也试图让Apache显示错误页面,例如,我关闭了Tomcat进行重新部署等。但是,我的httpd.conf中的ErrorDocument
指令似乎对本地文件没有任何作用。我试过外部URL和字符串,这两种情况都很好。但下面不起作用:ErrorDocument不能与本地文件配合使用
ErrorDocument 403 /Oops.html
ErrorDocument 404 /Oops.html
ErrorDocument 502 /Oops.html
ErrorDocument 503 /Oops.html
Oops.html文件位于我的htdocs文件夹中。下面是一些httpd的日志输出,当我尝试访问应用程序时,Tomcat没有运行,但httpd的是:我没有使用.htaccess文件
==> access_log <==
localhost - - [21/Nov/2010:12:23:36 -0800] "GET /home HTTP/1.1" 503 -
==> error_log <==
[Sun Nov 21 12:23:36 2010] [debug] mod_proxy_http.c(54): proxy: HTTP: canonicalising URL //localhost:8080/home
[Sun Nov 21 12:23:36 2010] [debug] proxy_util.c(1412): [client ::1] proxy: http: found worker http://localhost:8080/ for http://localhost:8080/home
[Sun Nov 21 12:23:36 2010] [debug] mod_proxy.c(819): Running scheme http handler (attempt 0)
[Sun Nov 21 12:23:36 2010] [debug] mod_proxy_http.c(1693): proxy: HTTP: serving URL http://localhost:8080/home
[Sun Nov 21 12:23:36 2010] [debug] proxy_util.c(1790): proxy: HTTP: retrying the worker for (localhost)
[Sun Nov 21 12:23:36 2010] [error] proxy: HTTP: disabled connection for (localhost)
[Sun Nov 21 12:23:36 2010] [debug] mod_proxy_http.c(54): proxy: HTTP: canonicalising URL //localhost:8080/Oops.html
[Sun Nov 21 12:23:36 2010] [debug] proxy_util.c(1412): [client ::1] proxy: http: found worker http://localhost:8080/ for http://localhost:8080/Oops.html
[Sun Nov 21 12:23:36 2010] [debug] mod_proxy.c(819): Running scheme http handler (attempt 0)
[Sun Nov 21 12:23:36 2010] [debug] mod_proxy_http.c(1693): proxy: HTTP: serving URL http://localhost:8080/Oops.html
[Sun Nov 21 12:23:36 2010] [debug] proxy_util.c(1790): proxy: HTTP: retrying the worker for (localhost)
[Sun Nov 21 12:23:36 2010] [error] proxy: HTTP: disabled connection for (localhost)
注意。似乎与htdocs文件夹有关的设置存在一些问题。下面是我的httpd.conf文件中与htdocs foler有关的一些内容。我刚刚与Apache合作,所以我不确定这是多么相关,或者我应该发布更多。
<Directory "/usr/local/apache2/htdocs">
Options Indexes FollowSymLinks
AllowOverride None
Order allow,deny
Allow from all
</Directory>
任何帮助非常感谢!
编辑:
当Tomcat运行我看到错误日志中的这些行:
[Sun Nov 21 13:30:11 2010] [error] [client ::1] Request exceeded the limit of 10 internal redirects due to probable configuration error. Use 'LimitInternalRecursion' to increase the limit if necessary. Use 'LogLevel debug' to get a backtrace.
[Sun Nov 21 13:30:11 2010] [debug] core.c(3046): [client ::1] r->uri = /Oops.html
[Sun Nov 21 13:30:11 2010] [debug] core.c(3052): [client ::1] redirected from r->uri = /Oops.html
[Sun Nov 21 13:30:11 2010] [debug] core.c(3052): [client ::1] redirected from r->uri = /Oops.html
[Sun Nov 21 13:30:11 2010] [debug] core.c(3052): [client ::1] redirected from r->uri = /Oops.html
[Sun Nov 21 13:30:11 2010] [debug] core.c(3052): [client ::1] redirected from r->uri = /Oops.html
[Sun Nov 21 13:30:11 2010] [debug] core.c(3052): [client ::1] redirected from r->uri = /Oops.html
[Sun Nov 21 13:30:11 2010] [debug] core.c(3052): [client ::1] redirected from r->uri = /Oops.html
[Sun Nov 21 13:30:11 2010] [debug] core.c(3052): [client ::1] redirected from r->uri = /Oops.html
[Sun Nov 21 13:30:11 2010] [debug] core.c(3052): [client ::1] redirected from r->uri = /Oops.html
[Sun Nov 21 13:30:11 2010] [debug] core.c(3052): [client ::1] redirected from r->uri = /Oops.html
[Sun Nov 21 13:30:11 2010] [debug] core.c(3052): [client ::1] redirected from r->uri =/
东西是不正确配置,但我没有什么我或者。感谢迄今为止的回应,但仍然难倒。
你有一定的RewriteRules某处沿线,也许在一个目录进一步上涨的树或配置? ....虽然在第二个想法,这可能是一个递归,因为它没有找到404文档,然后没有找到404文档,依此类推...... – 2010-11-21 21:40:27
检查是'DocumentRoot' +'/Ops.html' ='/ usr/local/apache2/htdocs/Ops.html'?有人认为你正在使用不同的DocumentRoot – ajreal 2010-11-21 21:47:53
@ajreal:我禁用了所有代理并删除了错误文档指令并重新启动。我能够访问我设置为DocumentRoot的目录中的其他几个页面,因此似乎设置正确。 – richever 2010-11-21 22:04:36