Welcome! Log In Create A New Profile

Advanced

Re: Using the access_log if directive in 1.6.x

Valentin V. Bartenev
December 11, 2014 01:40PM
On Thursday 11 December 2014 13:25:45 sudharshanr wrote:
[..]
>
> Hello Valentin,
>
> Thank you for your reply. Just one question. It is not just the 404 errors
> that I want to redirect. I want to redirect all 4xx and 5xx errors. I have
> updated my config file as below, but it doesn't seem to work. The 404 errors
> still go to access.log
>
> server {
> ...
> ...
> root /wdrive/www;
>
> access_log /mnt/log/nginx/access.log ;
> error_log /mnt/log/nginx/error.log;
>
> error_page 400 401 402 403 404 /error4x.html;
> error_page 500 501 502 503 /error5x.html;
>
> location /error4x.html{
> access_log /mnt/log/nginx/error.log;
> }
>
> location /error5x.html{
> access_log /mnt/log/nginx/error.log;
> }
>
> location / {
> ....
> }
> }
>
> I have created error4x.html page in /wdrive/www.
>
> Thanks.
>

By default, the errors generated by nginx itself are only handled
by the error_page directive. If you want to intercept errors from
upstream as well then you need to turn on proxy_intercept_errors.

See the docs: http://nginx.org/r/proxy_intercept_errors

It's always a good idea to provide your full configuration with
a question.

wbr, Valentin V. Bartenev

_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

Using the access_log if directive in 1.6.x

sudharshanr December 11, 2014 12:33AM

Re: Using the access_log if directive in 1.6.x

Valentin V. Bartenev December 11, 2014 08:18AM

Re: Using the access_log if directive in 1.6.x

sudharshanr December 11, 2014 01:25PM

Re: Using the access_log if directive in 1.6.x

Valentin V. Bartenev December 11, 2014 01:40PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 213
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready