问题:
重启虚拟机后,再次重启nginx会报错: open() “/var/run/nginx/nginx.pid” failed (2: No such file or directory)
解决方法:
进入 cd /usr/local/nginx/conf/ 目录,编辑配置文件nginx.conf ;
在配置文件中有个注释的地方: #pid logs/nginx.pid;
将注释放开,并修改为:pid /usr/local/nginx/logs/nginx.pid;
在 /usr/local/nginx 目录下创建 logs 目录:mkdir /usr/local/nginx/logs
启动nginx服务:/usr/local/nginx/sbin/nginx