Nginx 403 forbidden 错误的原因及解决方法
一、由于启动用户和nginx工作用户不一致所致
1.1查看nginx的启动用户,发现是nginx,而为是用root启动的
[root@iZwz96xkbmh1v1n08cvb5dZ /]# ps aux|grep nginx
root 2773 0.0 0.0 9068 844 ? Ss 13:56 0:00 nginx: master process /usr/sbin/nginx
nginx 2774 0.0 0.1 9476 2360 ? S 13:56 0:00 nginx: worker process
root 2916 0.0 0.0 221460 836 pts/0 R+ 13:59 0:00 grep --color=auto nginx
1.2将nginx.config的user改为和启动用户一致,
命令:vim etc/nginx.conf
# For more information on configuration, see:
# * Official English Documentation: http://nginx.org/en/docs/
# * Official Russian Documentation: http://nginx.org/ru/docs/
user root; //就是这里
worker_processes auto;
error_log /var/log/nginx/error.log;
pid /run/nginx.pid;
1.3 也可以使用如下命令直接查看
ps aux|grep nginx
[root@iZw