重新启动nginx后,出现报错,原因就是下没有nginx文件夹或没有nginx.pid文件,为什么会没有呢?

原因就是每次重新启动,系统都会自动删除文件,所以解决方式就是更改pid文件存储的位置,

打开nginx.conf配置文件,把红色部分打开,重启服务器或者重新加载配置文件,这样nginx.pid路径就更改成功!

   

接下来,创建logs文件夹

   

如何生成nginx.pid文件

在sbin/ 路径下执行  ./nginx -c /usr/local/nginx/conf/nginx.conf

就会自动生成pid文件

  

【防坑指南】nginx重启后出现[error] open() “/usr/local/var/run/nginx/nginx.pid” failed的更多相关文章

  1. nginx: [error] open() "/usr/local/var/run/nginx.pid" failed (2: No such file or directory)

    nginx: [error] open() "/usr/local/var/run/nginx.pid" failed (2: No such file or directory) ...

  2. nginx启动或者重启失败,报错nginx: [error] open() "/usr/local/var/run/nginx.pid" failed (2: No such file or directory)

    第一种方案: 1. 执行命令 :open /usr/local/etc/nginx 打开nginx安装目录 nginx安装目录默认位置有:(找到适合你的) /etc/nginx/nginx.conf, ...

  3. nginx报错 [error] open() “/usr/local/var/run/openresty.pid” failed (2: No such file or directory)

    解决: 服务没有启动 使用start启动服务,因为没有start而直接使用stop或者reload报错这个问题: 如果方法一没有解决,使用方法二:-C 指定配置文件nginx.conf或者weblua ...

  4. nginx: [error] invalid PID number “” in “/usr/local/var/run/nginx/nginx.pid”

    在Mac上用brew安装Nginx,然后修改Nginx配置文件,再重启时报出如下错误: nginx: [error] invalid PID number "" in " ...

  5. 安装HomeBrew 失败的解决方案(Error: Fetching /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core failed!)

    在安装HomeBrew(或者安装成功 执行相关指令)时遇到错误提示: Error: Failure while executing: git clone https://github.com/Home ...

  6. nginx启动报错nginx: [error] open() "/usr/local/etc/nginx/logs/nginx.pid" failed

    问题:nginx启动的时候会报丢失pid的错误 nginx: [error] open() “/usr/local/var/run/nginx.pid” failed 解决方案: sudo nginx ...

  7. SpringBoot整合log4j2进行日志配置及防坑指南

    写在前面 最近项目经理要求将原先项目中的日志配置logBack,修改为log4j2,据说是log4j2性能更优于logback,具体快多少,网上有说快10多倍,看来还是很快的,于是新的一波挑战又开始了 ...

  8. 新装NGINX重启,出现错误 nginx: [error] open() "/usr/local/nginx/logs/nginx.pid"

    重装nginx出现,重启出现错误 ./nginx -s reload nginx: [error] open() "/usr/local/nginx/logs/nginx.pid" ...

  9. position: sticky 防坑指南

    position: sticky 防坑指南:https://www.jianshu.com/p/e217905e8b87 今天在写小程序项目的时候碰到一个需求是要把轮播图下面的标签栏滑动到顶部后固定, ...

随机推荐

  1. POJ 3678 Katu Puzzle (2-SAT)

                                                                         Katu Puzzle Time Limit: 1000MS ...

  2. java多线程api

    Object类相关api(相关的方法一定是当前线程在获取了对应的锁对象才能调用,否则会抛出异常) o.wait() :锁对象调用该方法使当前线程进入等待状态,并立刻释放锁对象,直到被其他线程唤醒进入等 ...

  3. 打包JAR,MANIFEST.MF格式

    MANIFEST.MF文件格式详解 1. 基本格式 属性名称+:+空格+属性值 2. 没行最多72个字符,换行继续必须以空格开头 3. 文件最后必须要有一个回车换行 4. Class-Path 当前路 ...

  4. 虚拟机复制问题:如何解决“无法手动启动VMware Tools安装”问题

    摘录网址:https://jingyan.baidu.com/article/3c48dd348c4504e10ae35810.html 环境描述: VMware Workstation Ubuntu ...

  5. Ubuntu 18.04 设置开机启动脚本 rc.local systemd

    ubuntu18.04不再使用initd管理系统,改用systemd. ubuntu-18.04不能像ubuntu14一样通过编辑rc.local来设置开机启动脚本,通过下列简单设置后,可以使rc.l ...

  6. Uncaught DOMException: Failed to construct 'WebSocket': The URL '/qibao/websocket/service1000' is invalid.

    出现这个问题是构造 WebSocket失败了. js代码改成 //实现化WebSocket对象,指定要连接的服务器地址与端口 建立连接//等同于socket = new WebSocket(path+ ...

  7. LeetCode(193. Valid Phone Numbers)(sed用法)

    193. Valid Phone Numbers Given a text file file.txt that contains list of phone numbers (one per lin ...

  8. Chrome刷新缓存

    Ctrl+Shift+Del  清除Google浏览器缓存的快捷键  Ctrl+Shift+R  重新加载当前网页而不使用缓存内容

  9. Extjs 设置GridPanel单元格可选择高兼容写法

    网上大部分都是这种 <style type= "text/css" > .x-selectable, .x-selectable * { -moz-user-selec ...

  10. SSH中使用延迟加载报错Exception occurred during processing request: could not initialize proxy - no Session

    17:40:17,249 ERROR DefaultDispatcherErrorHandler:42 - Exception occurred during processing request: ...