Created
November 12, 2009 00:01
-
-
Save e1senh0rn/232441 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Placed under /usr/local/nginx/perl/lib/logger.pm | |
package logger; | |
use nginx; | |
sub handler { | |
my $r = shift; | |
if ($r->request_method eq "POST") { | |
open FILE, ">>/var/log/nginx/all.log" or return ""; | |
print FILE $r->request_body; | |
close FILE; | |
} | |
return ""; | |
} | |
1; | |
__END__ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
user www www; | |
worker_processes 64; | |
error_log /var/log/nginx/error.log; | |
pid /var/run/nginx.pid; | |
events { | |
worker_connections 512; | |
} | |
http { | |
include mime.types; | |
default_type application/octet-stream; | |
server_names_hash_bucket_size 128; | |
log_format main '$host $remote_addr [$time_local] $status "$request" $body_bytes_sent "$http_referer" "$http_user_agent"'; | |
access_log /var/log/nginx/access.log main; | |
sendfile on; | |
tcp_nopush on; | |
tcp_nodelay on; | |
perl_modules perl/lib; | |
perl_require logger; | |
server { | |
listen 80 default; | |
server_name _; | |
location /secret_logger { | |
perl logger::handler; | |
} | |
# Main location | |
location / { | |
add_before_body /secret_logger; | |
proxy_pass http://127.0.0.1:8080/; | |
proxy_redirect default; | |
proxy_set_header Host $host; | |
proxy_set_header X-Real-IP $remote_addr; | |
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | |
client_max_body_size 10m; | |
client_body_buffer_size 128k; | |
proxy_connect_timeout 5; | |
proxy_send_timeout 20; | |
proxy_read_timeout 90; | |
proxy_buffer_size 4k; | |
proxy_buffers 4 32k; | |
proxy_busy_buffers_size 64k; | |
proxy_temp_file_write_size 64k; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment