首页 文章

重新安装nginx如果我在centos服务器中删除/ etc / nginx如何重新安装它我是centos和nginx的新手

提问于
浏览
0

i install nginx in my remote server but i done some error in my nginx.conf file and could not able to revert back
所以它试图删除我的nginx并重新配置它
所以我使用链接中给出的这些步骤来删除我的nginx
http://www.ehowstuff.com/how-to-remove-uninstall-nginx-on-centos-7-rhel-7-oracle-linux-7/
然后我用
yum remove nginx 并再次重新安装它
但是当我尝试
sudo systemctl start nginx[root@lotto nginx]# service nginx start
它的表现

Job for nginx.service failed because the control process exitenter code hereed with error code. See "systemctl status nginx.service" and "journalctl -xe" for details .
我什么时候用
[root@lotto nginx]# systemctl status nginx.service
展示

nginx.service - nginx HTTP和反向代理服务器
已加载:已加载(/usr/lib/systemd/system/nginx.service;已启用;供应商预设:已禁用)
活动:失败(结果:退出代码)自周五2016-07-01 07:48:44 EDT; 18s ago Process:30832 ExecStartPre = / usr / sbin / nginx -t(code = exited,status = 1 / FAILURE)
处理:30830 ExecStartPre = / usr / bin / rm -f /run/nginx.pid(code = exited,status = 0 / SUCCESS)
主PID:14307(代码=退出,状态= 0 /成功)

Jul 01 07:48:44 lotto systemd [1]:启动nginx HTTP和反向代理服务器... Jul 01 07:48:44 lotto nginx [30832]:nginx:[emerg] getpwnam("nginx")在/ etc中失败/nginx/nginx.conf:5
Jul 01 07:48:44 lotto nginx [30832]:nginx:配置文件/etc/nginx/nginx.conf测试失败
Jul 01 07:48:44 lotto systemd [1]:nginx.service:控制进程退出,代码=退出状态= 1
Jul 01 07:48:44 lotto systemd [1]:无法启动nginx HTTP和反向代理服务器 .
Jul 01 07:48:44 lotto systemd [1]:单位nginx.service进入失败状态 . Jul 01 07:48:44 lotto systemd [1]:nginx.service失败了 .
[root@lotto nginx]# journalctl -xe

nginx.service - nginx HTTP和反向代理服务器
已加载:已加载(/usr/lib/systemd/system/nginx.service;已启用;供应商预设:已禁用)
活动:失败(结果:退出代码)自周五2016-07-01 07:48:44 EDT; 18年代前
进程:30832 ExecStartPre = / usr / sbin / nginx -t(code = exited,status = 1 / FAILURE)
处理:30830 ExecStartPre = / usr / bin / rm -f /run/nginx.pid(code = exited,status = 0 / SUCCESS)
主PID:14307(代码=退出,状态= 0 /成功)

2 回答

  • 0
    • 卸载

    yum remove nginx

    • 安装

    在CentOS中,你应该使用 yum install ;而不是Ubuntu中的 apt-get install .

  • 3

    最后我发现了自己的解决方案

    我使用了 nginx -t ,这表明我的代码中没有任何语法错误

    然后我用

    user nobody; // in my nginx.conf
    

    这解决了我的问题

    谢谢大家的帮助!

相关问题