/var/log/nginx/error.log删除后的恢复

原创
2019/12/18 20:45
阅读数 302

自动恢复的用户/组为root/root,而默认应该是www-data/adm

使用chown www-data:adm后用户/组是变了,但nginx仍然不能写入内容。


以下操作后还是不对:


samxiao@oioj:/var/log/nginx$ nginx
nginx: [alert] could not open error log file: open() "/var/log/nginx/error.log" failed (13: Permission denied)
2019/12/18 12:40:31 [warn] 1715#1715: the "user" directive makes sense only if the master process runs with super-user privileges, ignored in /etc/nginx/nginx.conf:1
2019/12/18 12:40:31 [emerg] 1715#1715: open() "/var/log/nginx/access.log" failed (13: Permission denied)
samxiao@oioj:/var/log/nginx$ sudo nginx -t
[sudo] password for samxiao:
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful
samxiao@oioj:/var/log/nginx$ sudo nginx -s reload
samxiao@oioj:/var/log/nginx$ ll
total 80
drwxr-xr-x  2 root     adm     4096 Dec 18 12:31 ./
drwxrwxr-x 12 root     syslog  4096 Dec 18 12:34 ../
-rw-r-----  1 www-data adm    62684 Dec 18 12:38 access.log
-rw-r-----  1 www-data adm       63 Dec 18 12:41 error.log
samxiao@oioj:/var/log/nginx$


samxiao@oioj:/var/log/nginx$ ll
total 80
drwxr-xr-x  2 root     adm     4096 Dec 18 12:31 ./
drwxrwxr-x 12 root     syslog  4096 Dec 18 12:34 ../
-rw-r-----  1 www-data adm    62684 Dec 18 12:38 access.log
-rw-r-----  1 www-data adm       63 Dec 18 12:41 error.log
samxiao@oioj:/var/log/nginx$ c
c: command not found
samxiao@oioj:/var/log/nginx$
samxiao@oioj:/var/log/nginx$
samxiao@oioj:/var/log/nginx$ cat error.log
2019/12/18 12:41:14 [notice] 1720#1720: signal process started

只有重装系统来解决了

展开阅读全文
打赏
0
0 收藏
分享
加载中
更多评论
打赏
0 评论
0 收藏
0
分享
返回顶部
顶部