Created
May 8, 2024 06:42
-
-
Save arbakker/dbbcd2a8e440ebaf83cc68666fc6f560 to your computer and use it in GitHub Desktop.
NGINX Log Headers
This file contains hidden or 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
// /etc/nginx/headers.js | |
function headers_json(r) { | |
return JSON.stringify(r.headersIn) | |
} | |
export default {headers_json}; |
This file contains hidden or 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
# /etc/nginx/nginx.conf | |
load_module modules/ngx_http_js_module.so; | |
worker_processes auto; | |
error_log /var/log/nginx/error.log notice; | |
pid /tmp/nginx.pid; | |
events { | |
worker_connections 1024; | |
} | |
http { | |
proxy_temp_path /tmp/proxy_temp; | |
client_body_temp_path /tmp/client_temp; | |
fastcgi_temp_path /tmp/fastcgi_temp; | |
uwsgi_temp_path /tmp/uwsgi_temp; | |
scgi_temp_path /tmp/scgi_temp; | |
include /etc/nginx/mime.types; | |
default_type application/octet-stream; | |
js_import headers.js; | |
js_set $headers_json headers.headers_json; | |
log_format main escape=none | |
'\nremote_addr: $remote_addr' | |
'\nremote_user: $remote_user' | |
'\ntime_local: $time_local' | |
'\nrequest: $request' | |
'\nstatus: $status' | |
'\nheaders_json: $headers_json' | |
'\nhttp_x_forwarded_for: $http_x_forwarded_for' | |
'\nProxy: "$proxy_host" "$upstream_addr"'; | |
access_log /var/log/nginx/access.log main; | |
sendfile on; | |
#tcp_nopush on; | |
keepalive_timeout 65; | |
#gzip on; | |
include /etc/nginx/conf.d/*.conf; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment