服务器 运维 nginx开启debug模式 - service

📅 2026-12-01 👤 拼多多助力营销技巧 📂 拼多多助力2027 👁️ 450 次阅读

在Nginx配置文件中,error_log和access_log指令的第二个参数是日志格式,不能直接使用debug作为日志格式。

如果想要开启debug级别的日志,可以使用下面的方式,修改nginx.conf配置文件:

## 对于error_log 直接在后面添加debug参数

error_log /var/log/nginx/error.log debug;

## 对于access_log,需要指定一种自定义的日志格式来输出debug级别的日志

log_format debuglog '[$time_local] $remote_addr $request_uri '

'$status $request_time $body_bytes_sent '

'"$http_referer" "$http_user_agent"';

access_log /var/log/nginx/access.log debuglog;

然后重启nginx服务器

systemctl restart nginx.service 拼多多帮助力入口

注意: access_log是用来记录Nginx服务器上客户端请求的日志指令,一般情况下不需要开启debug模式。access_log的日志级别默认为“info”,可以记录请求的基本信息,如时间、请求方法、请求URL、客户端IP地址等。如果需要更详细的请求日志信息,可以使用Nginx的“ngx_http_log_module”模块提供的其他日志格式。

参考书籍:《深入理解Nginx:模块开发与架构》 2.2.5

精彩内容

标签: 拼多多助力网站平台 赚钱项目 拼多多助力网 首码项目 手赚APP
拼多多助力营销技巧