error_page return code

Andrew Sitnikov sitnikov at infonet.ee
Mon Jul 7 13:46:54 MSD 2008


Hello nginx-ru,

  Есть такой конфиг

        error_page  501 =200  /errors/501.html;
        error_page  502 =200  /errors/502.html;                                                                                                              
        error_page  503 =200  /errors/503.html;                                                                                                              
        error_page  504 =200  /errors/504.html;                                                                                                              
        error_page  505 =200  /errors/505.html;                                                                                                              

        location /foo_504 {
                 return 504;
        }
        location /errors {                                                                                                                                   
            root $static_root/pics;                                                                                                                          
                                                                                                                                                             
            expires -1;                                                                                                                                      
                                                                                                                                                             
            if (!-f $request_filename) {                                                                                                                     
                rewrite . /errors/50x.html break;                                                                                                            
            }                                                                                                                                                
        }                                                                                                                                                    


  запрашиваем c backend долгий скрипт - GET /sleep_long.php HTTP/1.0  страница выдается нормально, но с кодом 504

2008/07/07 12:46:32 [debug] 20014#0: *27417 free rr peer failed: 1 0
2008/07/07 12:46:32 [error] 20014#0: *27417 upstream timed out (110: Connection timed out) while reading response header from upstream, client: 212.7.1.2, server: www.*****.**, request: "GET /sleep_long.php HTTP/1.1", upstream: "http://10.8.2.20:80/sleep_long.php", host: "www.*****.**"
2008/07/07 12:46:32 [debug] 20014#0: *27417 finalize http upstream request: 504
2008/07/07 12:46:32 [debug] 20014#0: *27417 finalize http proxy request
2008/07/07 12:46:32 [debug] 20014#0: *27417 free rr peer 0 0
2008/07/07 12:46:32 [debug] 20014#0: *27417 close http upstream connection: 143
2008/07/07 12:46:32 [debug] 20014#0: *27417 http finalize request: 504, "/sleep_long.php?"
2008/07/07 12:46:32 [debug] 20014#0: *27417 http special response: 504, "/sleep_long.php"
2008/07/07 12:46:32 [debug] 20014#0: *27417 http set discard body
2008/07/07 12:46:32 [debug] 20014#0: *27417 internal redirect: "/errors/50x.html?"
2008/07/07 12:46:32 [debug] 20014#0: *27417 generic phase: 1
2008/07/07 12:46:32 [debug] 20014#0: *27417 find location for "/errors/50x.html"
2008/07/07 12:46:32 [debug] 20014#0: *27417 find location: "/"
2008/07/07 12:46:32 [debug] 20014#0: *27417 find location: "/errors"
2008/07/07 12:46:32 [debug] 20014#0: *27417 find location: "/foo_504"
2008/07/07 12:46:32 [debug] 20014#0: *27417 find location for "/errors/50x.html"
2008/07/07 12:46:32 [debug] 20014#0: *27417 using configuration "/errors"
2008/07/07 12:46:32 [debug] 20014#0: *27417 http cl:-1 max:1048576
2008/07/07 12:46:32 [debug] 20014#0: *27417 generic phase: 3
2008/07/07 12:46:32 [debug] 20014#0: *27417 http script complex value
2008/07/07 12:46:32 [debug] 20014#0: *27417 http map started
2008/07/07 12:46:32 [debug] 20014#0: *27417 http map: "www.*****.**" "/data/pics/******/htdocs"
2008/07/07 12:46:32 [debug] 20014#0: *27417 http script var: ""
2008/07/07 12:46:32 [debug] 20014#0: *27417 http script copy: ""
2008/07/07 12:46:32 [debug] 20014#0: *27417 http script var: ""
2008/07/07 12:46:32 [debug] 20014#0: *27417 http script copy: ""
2008/07/07 12:46:32 [debug] 20014#0: *27417 http script var: "/data/pics/******/htdocs/pics/errors/50x.html0"
2008/07/07 12:46:32 [debug] 20014#0: *27417 http script copy: "/data/pics/******/htdocs/pics/errors/50x.html"
2008/07/07 12:46:32 [debug] 20014#0: *27417 http script file op 00000001 "/data/pics/******/htdocs/pics/errors/50x.html"
2008/07/07 12:46:32 [debug] 20014#0: *27417 add cleanup: 0A580784
2008/07/07 12:46:32 [debug] 20014#0: *27417 http script file op false
2008/07/07 12:46:32 [debug] 20014#0: *27417 http script if
2008/07/07 12:46:32 [debug] 20014#0: *27417 http script if: false
2008/07/07 12:46:32 [debug] 20014#0: *27417 post rewrite phase: 4
2008/07/07 12:46:32 [debug] 20014#0: *27417 generic phase: 5
2008/07/07 12:46:32 [debug] 20014#0: *27417 generic phase: 6
2008/07/07 12:46:32 [debug] 20014#0: *27417 access phase: 7
2008/07/07 12:46:32 [debug] 20014#0: *27417 access phase: 8
2008/07/07 12:46:32 [debug] 20014#0: *27417 post access phase: 9
2008/07/07 12:46:32 [debug] 20014#0: *27417 content phase: 10
2008/07/07 12:46:32 [debug] 20014#0: *27417 content phase: 11
2008/07/07 12:46:32 [debug] 20014#0: *27417 content phase: 12
2008/07/07 12:46:32 [debug] 20014#0: *27417 http set discard body
2008/07/07 12:46:32 [debug] 20014#0: *27417 http script var: ""
2008/07/07 12:46:32 [debug] 20014#0: *27417 http script copy: ""
2008/07/07 12:46:32 [debug] 20014#0: *27417 http filename: "/data/pics/******/htdocs/pics/errors/50x.html"
2008/07/07 12:46:32 [debug] 20014#0: *27417 add cleanup: 0A5807D4
2008/07/07 12:46:32 [debug] 20014#0: *27417 http static fd: 980
2008/07/07 12:46:32 [debug] 20014#0: *27417 HTTP/1.1 504 Gateway Time-out
Server: nginx/0.6.31
Date: Mon, 07 Jul 2008 09:46:32 GMT
Content-Type: text/html
Content-Length: 2947
Connection: keep-alive



делаем запрос на  /foo_504

получаем как просили страничу с кодом 200

2008/07/07 12:49:48 [debug] 20015#0: *111401 find location for "/foo_504"
2008/07/07 12:49:48 [debug] 20015#0: *111401 find location: "/"
2008/07/07 12:49:48 [debug] 20015#0: *111401 find location: "/errors"
2008/07/07 12:49:48 [debug] 20015#0: *111401 find location: "/foo_504"
2008/07/07 12:49:48 [debug] 20015#0: *111401 find location: "/frontchat"
2008/07/07 12:49:48 [debug] 20015#0: *111401 find location: "/panel"
2008/07/07 12:49:48 [debug] 20015#0: *111401 using configuration "/foo_504"
2008/07/07 12:49:48 [debug] 20015#0: *111401 http cl:-1 max:1048576
2008/07/07 12:49:48 [debug] 20015#0: *111401 generic phase: 3
2008/07/07 12:49:48 [debug] 20015#0: *111401 http finalize request: 504, "/foo_504?"
2008/07/07 12:49:48 [debug] 20015#0: *111401 http special response: 504, "/foo_504"
2008/07/07 12:49:48 [debug] 20015#0: *111401 http set discard body
2008/07/07 12:49:48 [debug] 20015#0: *111401 internal redirect: "/errors/504.html?"
2008/07/07 12:49:48 [debug] 20015#0: *111401 generic phase: 1
2008/07/07 12:49:48 [debug] 20015#0: *111401 find location for "/errors/504.html"
2008/07/07 12:49:48 [debug] 20015#0: *111401 find location: "/"
2008/07/07 12:49:48 [debug] 20015#0: *111401 find location: "/errors"
2008/07/07 12:49:48 [debug] 20015#0: *111401 find location: "/foo_504"
2008/07/07 12:49:48 [debug] 20015#0: *111401 find location for "/errors/504.html"
2008/07/07 12:49:48 [debug] 20015#0: *111401 using configuration "/errors"
2008/07/07 12:49:48 [debug] 20015#0: *111401 http cl:-1 max:1048576
2008/07/07 12:49:48 [debug] 20015#0: *111401 generic phase: 3
2008/07/07 12:49:48 [debug] 20015#0: *111401 http script complex value
2008/07/07 12:49:48 [debug] 20015#0: *111401 http map started
2008/07/07 12:49:48 [debug] 20015#0: *111401 http map: "www.*****.**" "/data/pics/*******/htdocs"
2008/07/07 12:49:48 [debug] 20015#0: *111401 http script var: ""
2008/07/07 12:49:48 [debug] 20015#0: *111401 http script copy: ""
2008/07/07 12:49:48 [debug] 20015#0: *111401 http script var: ""
2008/07/07 12:49:48 [debug] 20015#0: *111401 http script copy: ""
2008/07/07 12:49:48 [debug] 20015#0: *111401 http script var: "/data/pics/*******/htdocs/pics/errors/504.html7"
2008/07/07 12:49:48 [debug] 20015#0: *111401 http script copy: "/data/pics/*******/htdocs/pics/errors/504.html"
2008/07/07 12:49:48 [debug] 20015#0: *111401 http script file op 00000001 "/data/pics/*******/htdocs/pics/errors/504.html"
2008/07/07 12:49:48 [debug] 20015#0: *111401 add cleanup: 09CD5DAC
2008/07/07 12:49:48 [debug] 20015#0: *111401 http script if
2008/07/07 12:49:48 [debug] 20015#0: *111401 http script regex: "."
2008/07/07 12:49:48 [debug] 20015#0: *111401 http script copy: "/errors/50x.html"
2008/07/07 12:49:48 [debug] 20015#0: *111401 http script regex end
2008/07/07 12:49:48 [debug] 20015#0: *111401 post rewrite phase: 4
2008/07/07 12:49:48 [debug] 20015#0: *111401 generic phase: 5
2008/07/07 12:49:48 [debug] 20015#0: *111401 generic phase: 6
2008/07/07 12:49:48 [debug] 20015#0: *111401 access phase: 7
2008/07/07 12:49:48 [debug] 20015#0: *111401 access phase: 8
2008/07/07 12:49:48 [debug] 20015#0: *111401 post access phase: 9
2008/07/07 12:49:48 [debug] 20015#0: *111401 content phase: 10
2008/07/07 12:49:48 [debug] 20015#0: *111401 content phase: 11
2008/07/07 12:49:48 [debug] 20015#0: *111401 content phase: 12
2008/07/07 12:49:48 [debug] 20015#0: *111401 http set discard body
2008/07/07 12:49:48 [debug] 20015#0: *111401 http script var: ""
2008/07/07 12:49:48 [debug] 20015#0: *111401 http script copy: ""
2008/07/07 12:49:48 [debug] 20015#0: *111401 http filename: "/data/pics/*******/htdocs/pics/errors/50x.html"
2008/07/07 12:49:48 [debug] 20015#0: *111401 add cleanup: 09CD5E0C
2008/07/07 12:49:48 [debug] 20015#0: *111401 http static fd: 257
2008/07/07 12:49:48 [debug] 20015#0: *111401 HTTP/1.1 200 OK
Server: nginx/0.6.31
Date: Mon, 07 Jul 2008 09:49:48 GMT
Content-Type: text/html
Last-Modified: Thu, 03 Jul 2008 15:25:32 GMT
Transfer-Encoding: chunked
Connection: keep-alive
Expires: Mon, 07 Jul 2008 09:49:47 GMT
Cache-Control: no-cache
Content-Encoding: gzip




-- 
Best regards,
 Andrew                          mailto:sitnikov at infonet.ee






More information about the nginx-ru mailing list