posir 发表于 2018-11-15 10:16:13

nginx-error_log重定向

-bash-4.1# > log/error.log  -bash-4.1# > logs/error.log
  -bash-4.1# sed 's/\(^error_log.*\)/\1\naccess_log\ \ \/usr\/local\/nginx\/log\/access.log;/' conf/nginx.conf
  worker_processes1;
  error_log /usr/local/nginx/log/error.log;
  access_log/usr/local/nginx/log/access.log;
  events {
  worker_connections1024;
  }
  http {
  include mime.types;
  default_type application/octet-stream;
  sendfile on;
  keepalive_timeout 65;
  includetest/*;
  }
  -bash-4.1# sed -i 's/\(^error_log.*\)/\1\naccess_log\ \ \/usr\/local\/nginx\/log\/access.log;/' conf/nginx.conf
  -bash-4.1# ./sbin/nginx -t
  nginx: "access_log" directive is not allowed here in /usr/local/nginx/conf/nginx.conf:3
  nginx: configuration file /usr/local/nginx/conf/nginx.conf test failed

  -bash-4.1# ./sbin/nginx -s>  nginx: "access_log" directive is not allowed here in /usr/local/nginx/conf/nginx.conf:3
  -bash-4.1# cat log/error.log
  2018/08/24 14:45:43 5258#0: "access_log" directive is not allowed here in /usr/local/nginx/conf/nginx.conf:3
  2018/08/24 14:45:47 5267#0: "access_log" directive is not allowed here in /usr/local/nginx/conf/nginx.conf:3
  -bash-4.1# cat logs/error.log
  -bash-4.1#

页: [1]
查看完整版本: nginx-error_log重定向