Naming a virtual location to avoid logging results in 404s
Maxim Dounin
mdounin at mdounin.ru
Fri Apr 13 15:37:01 UTC 2012
Hello!
On Fri, Apr 13, 2012 at 10:28:18AM -0500, BigdinoWebmaster wrote:
> Maxim, thanks for the reply.
>
> There's no backend host; there is only the one server running
> nginx + php-fpm + the forum database. Should I just do a
> proxy_pass to localhost, or would that create a loop and cause
> bad things to happen?
To pass requests to php-fpm you have to use fastcgi_pass. And you
have to duplicate this fastcgi_pass for locations you've added.
Maxim Dounin
>
> Alternately, should I just create empty directories and files to
> match the location targets, or would that cause Nginx to try to
> GET and POST them instead?
>
>
>
> On Friday, April 13, 2012 at 10:19 AM, Maxim Dounin wrote:
>
> > Hello!
> >
> > On Fri, Apr 13, 2012 at 07:41:33AM -0500, BigdinoWebmaster wrote:
> >
> > > I'm hosting a forum using Vanilla
> > > (http://www.vanillaforums.org), and its internal statistics
> > > tracking involves no small amount of GETs and POSTs to URIs that
> > > don't correspond to actual directories underneath the web root.
> > > Since every active user on the forum generates lots of these
> > > every minute, I wanted to exclude them from being logged to keep
> > > the server logs from growing to an unreasonable size, and so I
> > > added the following three lines to my server config to stop
> > > logging of the three main ones:
> > >
> > > location /plugin/imonline { access_log off; log_not_found off; }
> > > location /dashboard/notifications/inform { access_log off;
> > > log_not_found off; }
> > > location /settings/analyticstick.json { access_log off;
> > > log_not_found off; }
> > >
> > >
> > > Prior to adding the lines, the requests to those locations would
> > > generate an HTTP 200 response and the corresponding analytic
> > > action (counting thread views, showing who is online, etc) would
> > > be recorded in the forum's database. After adding the lines, all
> > > GETs and POSTs receive 404s, like this:
> > >
> >
> >
> > [...]
> >
> > You should add correct processing to the locations you added as
> > well as access_log off, likely something like proxy_pass or
> > fastcgi_pass:
> >
> > location /plugin/imonline {
> > access_log off;
> > log_not_found off;
> > proxy_pass http://your.backend.host;
> > ...
> > }
> >
> > Without this requests which match these locations are processed as
> > static, and end up with 404 as there are no corresponding files.
> >
> > Maxim Dounin
> >
> > _______________________________________________
> > nginx mailing list
> > nginx at nginx.org (mailto:nginx at nginx.org)
> > http://mailman.nginx.org/mailman/listinfo/nginx
> >
> >
>
>
> _______________________________________________
> nginx mailing list
> nginx at nginx.org
> http://mailman.nginx.org/mailman/listinfo/nginx
More information about the nginx
mailing list