nginx总结

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了nginx总结相关的知识,希望对你有一定的参考价值。

nginx 安装目录 /usr/local/etc
nginx.conf目录 /usr/local/etc/nginx/nginx.conf
nginx web根目录 /usr/local/var/www/
//后期添加
nginx server配置目录 /usr/local/etc/nginx/servers
 
 
nginx 错误总结
 
1.nginx -s stop出现
nginx: [alert] could not open error log file: open() "/usr/local/var/log/nginx/error.log" failed (13: Permission denied)
 
sudo chmod a+w /usr/local/var/log/nginx/*.log
sudo chmod a+w /usr/local/var
sudo chmod a+w /usr/local/var/run
 
出处:https://stackoverflow.com/questions/42605202/how-do-i-configure-nginx-to-put-its-error-log-file-somewhere-i-have-write-privil
 
2.nginx -s stop出现
nginx: [alert] kill(2040, 15) failed (1: Operation not permitted)
 
sudo nginx -s stop
 
3. nginx -s reload出现
nginx: [error] open() "/usr/local/var/run/nginx.pid" failed (2: No such file or directory)
重新启动nginx(在nginx启动时候会生成nginx.pid文件,在nginx关闭会删除该文件,nginx重启也会去查找该文件,若找不到,启动nginx重新生成该文件)
 
4.sudo nginx 启动出现
nginx: [error] open() "/usr/local/var/run/nginx.pid" failed (2: No such file or directory)
删除/usr/local/var/run/nginx.pid文件
重新启动

以上是关于nginx总结的主要内容,如果未能解决你的问题,请参考以下文章

Nginx常见面试问题总结

Nginx一点总结

Nginx学习总结

nginx 基础总结

Nginx概述,搭建,配置实践总结

Nginx总结