Valentin V. Bartenev
December 11, 2014 08:18AM
On Thursday 11 December 2014 00:33:24 sudharshanr wrote:
> Hi,
>
> I'm using nginx 1.6.2 on Amazon ec2 linux server. The problem I'm having is
> that all my 404 errors are going to my access.log. I want them to be
> redirected to error.log instead.
>
> I saw on other forums that with nginx 1.7+, I can use the if directive of
> access_log to do something like:
>
> map $status $errorable {
> ~([^23][0-9][0-9]) 1;
> default 0;
> }
>
> access_log /media/ephemeral0/log/nginx/error.log combined if=$errorable;
>
> However, I'm not able to do the same with 1.6.2. I don't think I can update
> to 1.7+ as it is not available for ec2 linux servers yet. Is there an
> alternative for doing the same with 1.6.2?
>
> Thanks.
>

You can specify separate location for the 404 error page:

error_page 404 /404.html;

location /404.html {
access_log /media/ephemeral0/log/nginx/error.log combined;
}

Or use our official AMIs:
https://aws.amazon.com/marketplace/pp/B00A04GAG4

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: 195
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 500 on July 15, 2024
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready