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文件
重新启动
posted @   全玉  阅读(1902)  评论(0编辑  收藏  举报
编辑推荐:
· SQL Server 2025 AI相关能力初探
· Linux系列:如何用 C#调用 C方法造成内存泄露
· AI与.NET技术实操系列(二):开始使用ML.NET
· 记一次.NET内存居高不下排查解决与启示
· 探究高空视频全景AR技术的实现原理
阅读排行:
· 阿里最新开源QwQ-32B,效果媲美deepseek-r1满血版,部署成本又又又降低了!
· Manus重磅发布:全球首款通用AI代理技术深度解析与实战指南
· 开源Multi-agent AI智能体框架aevatar.ai,欢迎大家贡献代码
· 被坑几百块钱后,我竟然真的恢复了删除的微信聊天记录!
· AI技术革命,工作效率10个最佳AI工具
历史上的今天:
2016-09-02 tmux常用命令
点击右上角即可分享
微信分享提示