修改nginx.conf配置文件
使用lnmp的服务器一般配置文件在:/usr/local/nginx/conf/nginx.conf
使用宝塔Nginx的服务器一般配置文件在 :/www/server/nginx/conf/nginx.conf
打开添加
log_format main '"$http_x_forwarded_for"-$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';

log_format main 这里的main 需要在各个需要开启的站点配置文件里面加上

最后网站日志完美记录真实ip与cdn节点的ip

评论 (0)