nginx 配置:
user nginx;
worker_processes 1;
syslog local5 nginx;
error_log /var/log/nginx/nginx_error.log crit;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
#send the log to syslog and file.
access_log syslog:notice|logs/access.log main;
# pre 1.5.x
error_log syslog:notice|logs/error.log;
这样会把访问日志和错误日志都写入到local5 日志设备:
local{x} 日志设备的可用范围:
./configure --prefix=/usr/local/nginx --user=nginx --group=nginx --sbin-path=/usr/local/nginx/bin/nginx --conf-path=/etc/nginx/nginx.conf --pid-path=/var/run/nginx/nginx.pid --lock
部署nginx+rsyslog补丁
最新推荐文章于 2023-05-08 15:48:34 发布