Hello nginxers, I've read about the error_page[1] config setting and it's great. However serving a custom page instead of the error and just storing the error code in an entry in /var/nginx/log/error.log is not enough for me: I need to log the full page (the response besides the http status code). Is there any way to do this? Any config setting I missed? Or any nginx module that allows it? Thanks, Andres [1] http://wiki.nginx.org/HttpCoreModule#error_page
on 2012-09-26 12:15
on 2012-09-26 14:28
> serving a custom page instead of the error and just storing the error code > in an entry in /var/nginx/log/error.log is not enough for me: I need to > log the full page (the response besides the http status code). > Is there any way to do this? Any config setting I missed? This suggests your are using dynamic language (like php) for serving error pages, right? While it probably could be done with nginx itself (with using lua/perl modules) in case of php you could just buffer the whole output ( http://php.net/manual/en/function.ob-start.php ) and store wherever you want. rr
on 2012-09-26 20:36
On 26/09/12 13:27, Reinis Rozitis wrote: >> serving a custom page instead of the error and just storing the error >> code in an entry in /var/nginx/log/error.log is not enough for me: I >> need to log the full page (the response besides the http status code). >> Is there any way to do this? Any config setting I missed? > > This suggests your are using dynamic language (like php) for serving > error pages, right? Why? No. I'm using a VM (that allows dynamic and static languages on top, but the question of what kind of typing my language has I guess is already out of topic). > While it probably could be done with nginx itself (with using lua/perl > modules) in case of php you could just buffer the whole output ( > http://php.net/manual/en/function.ob-start.php ) and store wherever you > want. I'm using fastcgi for the communication between nginx and the application server. Do you think there is some setting in the fastcgi configuration that would help me? Thanks
on 2012-09-26 20:40
On 26/09/12 19:35, Andres G. Aragoneses wrote: > On 26/09/12 13:27, Reinis Rozitis wrote: >>> serving a custom page instead of the error and just storing the error >>> code in an entry in /var/nginx/log/error.log is not enough for me: I >>> need to log the full page (the response besides the http status code). >>> Is there any way to do this? Any config setting I missed? >> >> This suggests your are using dynamic language (like php) for serving >> error pages, right? BTW, I'm not trying to log the error page I want to serve, but the error page I got from the fastcgi source.
on 2012-09-27 01:08
> I'm using fastcgi for the communication between nginx and the application > server. > Do you think there is some setting in the fastcgi configuration that would > help me? You can try to use fastcgi_store ( http://wiki.nginx.org/HttpFastcgiModule#fastcgi_store ) - it allows nginx to store the response from backend locally. rr
on 2012-09-28 02:37
On 27/09/12 00:08, Reinis Rozitis wrote: >> I'm using fastcgi for the communication between nginx and the >> application server. >> Do you think there is some setting in the fastcgi configuration that >> would help me? > > You can try to use fastcgi_store ( > http://wiki.nginx.org/HttpFastcgiModule#fastcgi_store ) - it allows > nginx to store the response from backend locally. Thanks Reinis, I'll give that a go.
Please log in before posting. Registration is free and takes only a minute.
Existing account
(Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
Log in with Google account | Log in with Yahoo account
No account? Register here.