Добрый день!

Своими силами проблему никак решить не могу. В дополнение прикладываю часть debug.log из которого видно, что идет внутренний редирект к странице 500.html,
когда имеет место 404-ая ошибка и апстрим на нее не ответил.
А вот в случае 403-ей ошибки, когда апстрим не отвечает, то такого редиректа для отдачи 500.html не срабатывает и Nginx отдает свою собственную 502-ую.

======================================================
2013/04/18 14:07:30 [error] 17044#0: *124 connect() failed (113: No route to host) while connecting to upstream, client: 192.168.10.128, server: localhost, request: "GET /info.php HTTP/1.1", upstream: "http://192.168.56.101:8000/info.php";, host: "192.168.10.128"
2013/04/18 14:07:30 [debug] 17044#0: *124 http next upstream, 2
2013/04/18 14:07:30 [debug] 17044#0: *124 free rr peer 1 4
2013/04/18 14:07:30 [debug] 17044#0: *124 finalize http upstream request: 502
2013/04/18 14:07:30 [debug] 17044#0: *124 finalize http proxy request
2013/04/18 14:07:30 [debug] 17044#0: *124 free rr peer 0 0
2013/04/18 14:07:30 [debug] 17044#0: *124 close http upstream connection: 6
2013/04/18 14:07:30 [debug] 17044#0: *124 free: 0902A4F0, unused: 88
2013/04/18 14:07:30 [debug] 17044#0: *124 event timer del: 6: 480106897
2013/04/18 14:07:30 [debug] 17044#0: *124 delete posted event 0904B688
2013/04/18 14:07:30 [debug] 17044#0: *124 reusable connection: 0
2013/04/18 14:07:30 [debug] 17044#0: *124 http finalize request: 502, "/info.php?" a:1, c:1 2013/04/18 14:07:30 [debug] 17044#0: *124 http special response: 502, "/info.php?"
2013/04/18 14:07:30 [debug] 17044#0: *124 internal redirect: "/500.html?"
2013/04/18 14:07:30 [debug] 17044#0: *124 rewrite phase: 1
2013/04/18 14:07:30 [debug] 17044#0: *124 http script var
2013/04/18 14:07:30 [debug] 17044#0: *124 http script var: ""
2013/04/18 14:07:30 [debug] 17044#0: *124 http script value: "on"
=======================================================
2013/04/18 14:11:46 [error] 17044#0: *127 connect() failed (113: No route to host) while connecting to upstream, client: 192.168.10.128, server: localhost, request: "GET /pool/ HTTP/1.1", upstream: "http://192.168.56.101:8000/pool/";, host: "192.168.10.128"
2013/04/18 14:11:46 [debug] 17044#0: *127 http next upstream, 2
2013/04/18 14:11:46 [debug] 17044#0: *127 free rr peer 1 4
2013/04/18 14:11:46 [debug] 17044#0: *127 finalize http upstream request: 502
2013/04/18 14:11:46 [debug] 17044#0: *127 finalize http proxy request
2013/04/18 14:11:46 [debug] 17044#0: *127 free rr peer 0 0
2013/04/18 14:11:46 [debug] 17044#0: *127 close http upstream connection: 6
2013/04/18 14:11:46 [debug] 17044#0: *127 free: 0903AE20, unused: 88
2013/04/18 14:11:46 [debug] 17044#0: *127 event timer del: 6: 480363426
2013/04/18 14:11:46 [debug] 17044#0: *127 delete posted event 0904B688
2013/04/18 14:11:46 [debug] 17044#0: *127 reusable connection: 0
2013/04/18 14:11:46 [debug] 17044#0: *127 http finalize request: 502, "/pool/?" a:1, c:1 2013/04/18 14:11:46 [debug] 17044#0: *127 http special response: 502, "/pool/?"
2013/04/18 14:11:46 [debug] 17044#0: *127 http set discard body
2013/04/18 14:11:46 [debug] 17044#0: *127 xslt filter header
2013/04/18 14:11:46 [debug] 17044#0: *127 HTTP/1.1 502 Bad Gateway
Server: nginx/1.1.19
Date: Thu, 18 Apr 2013 10:11:46 GMT
Content-Type: text/html
Content-Length: 173
Connection: keep-alive





On 17.04.2013 16:14, Alex Belyansky wrote:
Добрый день!

Имею вот такое в конфигурации:

error_page 500 501 502 503 504 /500.html;


location / {
            try_files   $uri    $uri/   @upstream;
            error_page  404 = @upstream;
            error_page  403 = @upstream;
}

location @upstream {
    proxy_pass  http://backend;
}


Когда нет связи с бекендом и при этом запрашивается несуществующая страница (404), то nginx нормально отображает мою 500.html А вот когда запрашивается страница с ошибкой по правам доступа (403), то nginx отображает свою дефолтовую страницу, вместо моей 500.html

Что делаю не так? Где что прописать, чтобы нормально отображалась моя 500.html для ситуации с 403-ей ?

_______________________________________________
nginx-ru mailing list
[email protected]
http://mailman.nginx.org/mailman/listinfo/nginx-ru

Ответить