开发者

Apache Error Document is not working

开发者 https://www.devze.com 2023-03-20 04:59 出处:网络
I am running the apache2 webserver in the linux environment.I want to redirect the users to customized error pages.So have created the error pages & created the symbolic link in the htdocs also li

I am running the apache2 webserver in the linux environment.I want to redirect the users to customized error pages.So have created the error pages & created the symbolic link in the htdocs also like this. static-files -> /app/static-files. And in the httpd.conf file I have created the virtual host definition and included the error pages also like below:

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>

When my app server is down,its not redirecting me to 503 customized error page.I am getting the server specific error page only.But if i put this ErrorDocument out of the virtual host definition its redirecting me to the customized error page. I am striking my head for 3 days.But not able to find the reason.I tried in all browsers.Anybody can help me ?


As you defined DocumentRoot to be "/app/httpd-2.2.15/htdocs", the error pages should be in this directory. Are you sure that the error pages are in this directory?


I'm not 100% sure but when you have an app server running behind Apache and when it is down you have a 404 not found. It's not a 503 answer. 503 occurs when there is fault on the server (either Apache of the App server) such as load or anything that could happen following a miss configuration.

0

精彩评论

暂无评论...
验证码 换一张
取 消