nginx:access.log和error.log文件为空 [英] nginx : access.log and error.log file empty

查看:1684
本文介绍了nginx:access.log和error.log文件为空的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚刚使用命令在Ubuntu 14.04上安装了nginx

I have just installed nginx on Ubuntu 14.04 using the command

sudo apt-get install nginx

现在,当我打开浏览器并输入地址localhost时,将正确显示"Welcome to nginx"页面.另外,我检查了位于/etc/nginx/nginx.conf的配置文件,发现以下日志设置:

Now, when I open my browser and type in the address localhost then I am correctly shown the "Welcome to nginx" page. Also, I checked the config file located in /etc/nginx/nginx.conf and found the following log settings:

access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;

但是,当我检查这两个文件时,它们都是空的.我已经多次打开localhost页,但是日志文件仍然是空的.我的设置可能有什么问题?

However, when I check these two files, both are empty. I have opened the localhost page multiple times but still the log files are empty. What might be wrong with my setup ?

推荐答案

将nginx重新安装到较新版本后,我遇到了同样的问题.似乎日志文件的所有权已更改,新的nginx无法在那里保存任何内容.

I had the same issue after reinstalling nginx to newer version. Seems like log files ownership changed and new nginx couldn't save anything there.

删除日志文件并重新加载nginx对我有用:

Removing log files and reloading nginx worked for me:

$ sudo rm -f /var/log/nginx/*
$ sudo nginx -s reload

这篇关于nginx:access.log和error.log文件为空的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆