Nginx不在access.log中写入任何内容
我正在使用Unicorn在Nginx上开发Rails应用程序。 当我使用Capistrano启动Nginx时,但无法写入access.log 我也更改了日志目录和文件的权限和用户,但它对我不起作用。 有人能帮我吗 我的nginx.conf是这样的Nginx不在access.log中写入任何内容,nginx,unicorn,Nginx,Unicorn,我正在使用Unicorn在Nginx上开发Rails应用程序。 当我使用Capistrano启动Nginx时,但无法写入access.log 我也更改了日志目录和文件的权限和用户,但它对我不起作用。 有人能帮我吗 我的nginx.conf是这样的 user nginx; worker_processes 1; error_log /var/log/nginx/error.log warn; pid /var/run/nginx.pid; events { worker
user nginx;
worker_processes 1;
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 main;
sendfile on;
keepalive_timeout 65;
upstream unicorn {
server unix:/tmp/unicorn.sock fail_timeout=0;
}
server {
listen 80 default_server;
server_name _;
location ~ ^/assets/ {
root /home/vagrant/xxx/public;
}
location / {
proxy_pass http://unicorn;
}
}
}
我已经将用户从“nginx”改为“vagrant”。
('vagrant'是服务器的ssh用户)
目录:
drwx------ 2 vagrant vagrant 4096 Nov 20 18:53 nginx
日志文件:
-rw-r--r-- 1 nginx nginx 0 Nov 20 18:53 access.log
-rw-r--r-- 1 vagrant vagrant 0 Nov 20 18:53 error.log
unicorn.rb(位于rails应用程序中)
之后,我注意到nginx.conf中有一些错误
listen "/tmp/unicorn.sock"
worker_processes 2 # this should be >= nr_cpus
working_directory "/home/vagrant/xxx/current"
pid "/home/vagrant/xxx/shared/tmp/pids/unicorn.pid"
stderr_path "/home/vagrant/xxx/shared/log/unicorn.log"
stdout_path "/home/vagrant/xxx/shared/log/unicorn.log"
before_exec do |server|
ENV['BUNDLE_GEMFILE'] = "/home/vagrant/xxx/current/Gemfile"
end