2011-07-13 45 views
3

我正在linux环境中运行apache2 web服务器。我想将用户重定向到自定义错误页面。所以创建了错误页面&在htdocs中创建了符号链接。静态文件 - > /应用程序/静态文件。 而在httpd.conf文件我已经创建的虚拟主机定义,包括错误网页也喜欢下面:Apache错误文档不起作用

NameVirtualHost m.mydomain.com:80 

    <VirtualHost m.mydomain.com:80> 
    DocumentRoot "/app/httpd-2.2.15/htdocs" 
    ServerName m.mydomain.com:80 

    <Directory "/static-files/html/error_pages"> 
    Options FollowSymLinks 
     Order allow,deny 
     Allow from all 
    </Directory> 

    ErrorLog /app/httpd-2.2.15/logs/error_my_log 
    ErrorDocument 400 /static-files/html/error_pages/error_400.html 
    ErrorDocument 401 /static-files/html/error_pages/error_401.html 
    ErrorDocument 403 /static-files/html/error_pages/error_403.html 
    ErrorDocument 404 /static-files/html/error_pages/error_404.html 
    ErrorDocument 408 /static-files/html/error_pages/error_408.html 
    ErrorDocument 500 /static-files/html/error_pages/error_500.html 
    ErrorDocument 501 /static-files/html/error_pages/error_501.html 
    ErrorDocument 502 /static-files/html/error_pages/error_502.html 
    ErrorDocument 503 /static-files/html/error_pages/error_503.html 
    ErrorDocument 504 /static-files/html/error_pages/error_504.html 
    </VirtualHost> 

当我的应用程序服务器宕机,它不是重定向我503自定义错误page.I上午只能得到服务器特定的错误页面。但是如果我把这个ErrorDocument放在虚拟主机定义之外,它会将我重定向到自定义的错误页面。我打了3天头,但没能找到原因。我在所有浏览器中都试过。任何人都可以帮助我?

回答

0

我不是100%确定的,但是当你有一台运行在Apache后面的应用程序服务器,并且它停止运行时,你会发现404没有找到。 这不是503答案。当服务器(App Server的Apache)发生故障(例如加载或任何可能在未命中配置后发生的事件)时,会发生503。

+0

但我很明显在我的访问日志中得到了503错误。当我将ErrorDocument放在虚拟主机定义之外时,它也重定向到503 ErrorDocument。 – Suresh