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

在重启nginx服务的时候,出现了这个错误。

[[email protected] etc]# nginx -c /var/run/nginx/nginx.pid
nginx: [emerg] open() "/var/run/nginx/nginx.pid" failed (2: No such file or directory)

解决办法:

[[email protected] etc]# nginx -c /etc/nginx/nginx.conf

其他的一些解决办法:

1、进入到文件夹下:cd /var/run ,查看有没有nginx文件夹,如果没有,则创建,然后在启动

2、进入到 nginx.conf文件,找到如下pid的位置,对pid这一行注释掉。然后重启。

user  root;
worker_processes  1;

error_log  /var/log/nginx/error.log warn;
pid /var/run/nginx/nginx.pid;

events {
    worker_connections  1024;
}

原文地址:https://www.cnblogs.com/zengfp/p/10101129.html

时间: 2024-10-06 00:43:21

nginx: [error] open() "/var/run/nginx/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)

nginx: [error] open() "/usr/local/var/run/nginx.pid" failed (2: No such file or directory) 2017年09月14日 09:15:45 阅读数:7742 启动Nginx出现这个错误 nginx: [error] open() "/usr/local/var/run/nginx.pid" failed (2: No such file or directory) 1  解决方法:找

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

问题场景 服务器重启后,重启nginx时报错nginx: [error] open() "/usr/local/nginx/logs/nginx.pid" failed (2: No such file or directory),进入到logs目录发现确实没有nginx.pid文件 解决办法 使用指定nginx.conf文件的方式重启nginx /usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf还有一种可能就

解决nginx: [error] open() "/usr/local/nginx/logs/nginx.pid" failed (2: No such file or directory)错误

服务器重启后,重启nginx时报错nginx: [error] open() "/usr/local/nginx/logs/nginx.pid" failed (2: No such file or directory),进入到logs目录发现确实没有nginx.pid文件 cd /usr/local/nginx/sbin/ ./nginx -s reload ngx_http_fastdfs_set pid=1412 ngx_http_fastdfs_set pid=1412 ngx

nginx 首旅之坑(/usr/local/nginx/logs/nginx.pid" failed (2: No such file or directory))

第一次按教程安装nginx ,启动NGINX时出错,百度解决方法如下: ========================= 需要停止或者重启nginx的命令如下 /usr/local/nginx/sbin/nginx -s stop /usr/local/nginx/sbin/nginx -s reload 发现报以下错误: nginx: [error] open() "/usr/local/nginx/logs/nginx.pid" failed (2: No such file o

nginx 启动出现 [error] open() "/usr/local/nginx/logs/nginx.pid" failed (2: No such file or directory)

1.nginx 启动出现: 2.打开nginx.conf配置文件,把下面红色部分打开,重启服务器或者重新加载配置文件,这样nginx.pid路径就更改成功! 3. 在sbin/ 路径下执行  ./nginx -c /usr/local/nginx/conf/nginx.conf 出现问题 这个问题是端口被占用 根据Nginx配置文件查看配置的端口(本文中使用的是80端口),然后根据端口查看端口占用情况 . 使用kill命令杀死占用进程,之后重新启动Nginx kill -9 12256 重新启动

解决Nginx: [error] open() "/usr/local/Nginx/logs/Nginx.pid

重新启动服务器,访问web服务发现无法浏览啦!登陆服务器之后进到nginx使用./nginx -s reload重新读取配置文件,发现报nginx: [error] open() "/usr/local/nginx/logs/nginx.pid" failed (2: No such file or directory)错误,进到logs文件发现的确没有nginx.pid文件 [[email protected] sbin]# ./nginx -s reload nginx: [err

解决nginx: [error] open() "/usr/local/nginx/logs/nginx.pid" failed错误

重新启动服务器,访问web服务发现无法浏览啦!登陆服务器之后进到nginx使用./nginx -s reload重新读取配置文件,发现报nginx: [error] open() "/usr/local/nginx/logs/nginx.pid" failed (2: No such file or directory)错误,进到logs文件发现的确没有nginx.pid文件 [[email protected] sbin]# ./nginx -s reload nginx: [err

nginx和php-fpm配置 错误connect() failed (111: Connection refused) while connecting to upstream connect() to unix:/run/php/php7.2-fpm.sock failed (2: No such file or directory) while connecting to upstream

若fpm配置文件中配置如下: listen = 127.0.0.1:9000 则对应的nginx.conf中的配置应为: fastcgi_pass 127.0.0.1:9000; 此时开启9000端口监听,不会生成sock文件 若fpm中的配置为使用Unix套接字,如下: listen = /run/php/php7.2-fpm.sock 则对应nginx.conf中的配置应为: fastcgi_pass unix:/run/php/php7.2-fpm.sock; 此时9000端口未开启,在/

关于nginx配置的一个报错connect() to unix:/tmp/php-cgi.sock failed (2: No such file or directory)

针对配置php的情况: linux服务器一般提示这个 connect() to unix:/tmp/php-cgi.sock failed (2: No such file or directory) while connecting to upstream, client: x.x.x.x, server: xxx.xxx.xxx, request: "GET /index.php HTTP/1.1", upstream: "fastcgi://unix:/tmp/php-