概述
#user nobody;
worker_processes 1;
error_log "pipe:rollback /usr/local/nginx/logs/error_log interval=1d baknum=7";
#pid logs/nginx.pid;
events {
worker_connections 1024;
}
# load modules compiled as Dynamic Shared Object (DSO)
#
#dso {
# load ngx_http_fastcgi_module.so;
# load ngx_http_rewrite_module.so;
#}
http {
include mime.types;
default_type application/octet-stream;
log_format prismformat "[$time_local] $http_requestId $remote_addr $request_time $upstream_response_time $http_x_readtime "$request_method" $status $body_bytes_sent "$http_referer" "$upstream_addr" "$http_user_agent" "$upstream_status"";
log_format gongchengformat "[$time_local] $upstream_http_requestId $remote_addr $request_time $upstream_response_time $http_x_readtime "$request_method" $status $body_bytes_sent "$http_referer" "$upstream_addr" "$http_user_agent" "$upstream_status"";
sendfile on;
#tcp_nopush on;
#keepalive_timeout 0;
keepalive_timeout 65;
#gzip on;
client_header_timeout 1m;
send_timeout 1m;
client_max_body_size 30m;
upstream ocr_ups {
keepalive 512;
server 127.0.0.1:1111;
#server1server
#server2server
#server3server
#server4server
#server5server
#server6server
#server7server
#server8server
#server9server
#server10server
#server11server
#server12server
#server13server
#server14server
#server15server
}
server {
access_log "pipe:rollback /usr/local/nginx/logs/access_log interval=1d baknum=7" gongchengformat;
listen 80;
server_name localhost;
location / {
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_pass http://127.0.0.1:9137;
}
}
server {
access_log "pipe:rollback /usr/local/nginx/logs/access_log interval=1d baknum=7" prismformat;
listen 127.0.0.1:9138;
keepalive_timeout 65;
location / {
proxy_pass http://ocr_ups;
proxy_http_version 1.1;
proxy_set_header Connection "Keep-Alive";
}
}
}
最后
以上就是美好小甜瓜为你收集整理的nginx定制化输出日志的全部内容,希望文章能够帮你解决nginx定制化输出日志所遇到的程序开发问题。
如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。
发表评论 取消回复