我跑的时候
sudo nginx -c /etc/nginx/nginx.conf -t
我收到此消息
nginx: [emerg] invalid parameter "if=$loggable" in
/etc/nginx/nginx.conf:33
nginx: configuration file /etc/nginx/nginx.conf test failed
这是我的/etc/nginx/nginx.conf
user nginx;
worker_processes auto;
error_log /var/log/nginx/error.log warn;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
}
http {
include /etc/nginx/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"';
access_log /var/log/nginx/access.log;
# access_log /var/log/nginx/access.log main;
# access_log /var/log/nginx/access.log main buffer=size flush=time;
# Custom Log Owner
map $status $loggable {
~^2 1;
default 0;
}
log_format owner_log '{"owner_id":"$arg_owner_id","status":"$status","bytes":"$body_bytes_sent","created":"$time_local"}';
access_log /var/log/nginx/owner.log owner_log if=$loggable;
sendfile on;
#tcp_nopush on;
keepalive_requests 10000;
keepalive_timeout 65;
include /etc/nginx/conf.d/nginx_inmobly_sdk.conf;
}
我的所有日志文件都属于nginx用户 我无法意识到这就是问题所在 我用ubuntu 什么是日志文件的默认权限? 哪个用户应该运行nginx