CentOS启动nginx出现nginx: [emerg] open() "/var/run/nginx/nginx.pid" failed (2: No such file or director)

问题:

1.进入sbin:cd /usr/local/nginx/sbin/
2.启动nginx:./nginx

3.出现问题: nginx: [emerg] open() "/var/run/nginx/nginx.pid" failed (2: No such file or directory)


原因:没有nginx文件夹,且其下没有nginx.pid文件


解决办法:创建文件

1.进入run下:cd /var/run


2.创建nginx文件夹:mkdir nginx


3.创建nginx.pid文件:touch nginx.pid


4.进入sbin文件夹:cd /usr/local/nginx/sbin/


5.启动nginx:./nginx

6.测试是否成功:打开浏览器,地址输入localhost,出现欢迎页面

CentOS启动nginx出现nginx: [emerg] open()

你可能感兴趣的:(CentOS启动nginx出现nginx: [emerg] open() "/var/run/nginx/nginx.pid" failed (2: No such file or director))