我使用Apache2作为tomcat的反向代理,我的configuration是这样的:
ProxyRequests Off ProxyPass / http://localhost:8080/ ProxyPassReverse / http://localhost:8080/
我的问题是:每当Tomcatclosures时,我可以configurationApache来显示一个礼貌的页面(一个“在build的”HTML静态页面)吗?
您可以使用Apache ErrorDocument指令来执行此操作。 你应该使用一个URL来指向你的ErrorDocument,否则,如果你使用一个文件系统引用,你会得到额外的503,同时试图find它。
ErrorDocument 503 http://somehost.tld/errors/503.html
无法连接到Tomcat时,Apache将会发出503“服务不可用”错误。 你可以创build一个“很好”的503错误页面。
ErrorDocument 503 /var/www/html/error/gonefishing.html
如果你的本地服务器有apache监听默认端口,你可以指向一个错误的uri到本地主机,并在那里有自定义的错误页面。 将否定分开的域/服务器的需要
ProxyPass /ERROR http:// localhost:80/ ProxyPass / http:// localhost:8080/ ProxyPassReverse / http:// localhost:8080/ ErrorDocument 503 /ERROR/custom_50x.html
@ snyman的信息中列出的ProxyPass语句的顺序非常重要。在写入任何其他proxypass语句之前,proxypass错误应该是虚拟主机的第一个proxypass语句。
这是我的经验与apache 2.4和tomcat7的centos 7
请原谅我的无知。但是不能把ProxyPass / var / www / html / error! 忽略该文件夹,然后从该文件夹提供页面?