在ubuntu使用时碰到的一个问题,修改了nginx服务的配置文件后,重启服务,显示
* Restarting nginx nginx [fail]
检查一下配置文件,没有问题,还原配置文件到修改前的状态,再次执行服务重启命令,依然报错,
按nginx的指导 使用nginx -t 查看错误原因
yumu_tech@yumutech009:~/nginx/conf/conf.d$ nginx -t
nginx: [warn] the "user" directive makes sense only if the master process runs with super-user privileges, ignored in /etc/nginx/nginx.conf:2nginx: the configuration file /etc/nginx/nginx.conf syntax is oknginx: [emerg] open() "/run/nginx.pid" failed (13: Permission denied)nginx: configuration file /etc/nginx/nginx.conf test failed错误说明 13: Permission denied
改用sudo 执行命令 sudo service nginx restart
* Restarting nginx nginx [ OK ]
问题总结
遇到 Permission denied 提示的改为root用户操作或者使用sudo命令操作基本可以解决问题,总结一下就是遇到操作失败时,首先看错误日志,
如遇到13: Permission denied的提示,表示权限不够,使用sudo 执行或换到root用户下操作,即可成功操作