【问题标题】:reinstall nginx if i delete /etc/nginx in centos server how to reinstall it again i am new in centos and nginx如果我在centos服务器上删除/ etc / nginx,请安装nginx如何重新安装它我是centos和nginx的新手
【发布时间】:2016-11-03 18:55:18
【问题描述】:

我在远程服务器上安装了 nginx,但我在 nginx.conf 文件中出现了一些错误,无法恢复
所以它试图删除我的 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
它显示

nginx.service 的作业失败,因为控制进程 exitenter code hereed 带有错误代码。详见“systemctl status nginx.service”和“journalctl -xe”
当我使用
[root@lotto nginx]# systemctl status nginx.service
显示

nginx.service - nginx HTTP 和反向代理服务器
已加载:已加载(/usr/lib/systemd/system/nginx.service;已启用;供应商预设:已禁用)
活动:自美国东部时间周五 2016 年 7 月 1 日 07:48:44 以来失败(结果:退出代码); 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(code=exited,status=0/SUCCESS)

Jul 01 07:48:44 lotto systemd[1]: 启动 nginx HTTP 和反向代理服务器... 7 月 1 日 07:48:44 乐透 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: 控制进程退出,code=exited status=1
Jul 01 07:48:44 lotto systemd[1]: 无法启动 nginx HTTP 和反向代理服务器。
Jul 01 07:48:44 lotto systemd[1]: 单元 nginx.service 进入失败状态。 7 月 1 日 07:48:44 乐透 systemd[1]: nginx.service 失败。
[root@lotto nginx]# journalctl -xe

nginx.service - nginx HTTP 和反向代理服务器
已加载:已加载(/usr/lib/systemd/system/nginx.service;已启用;供应商预设:已禁用)
活动:自美国东部时间周五 2016 年 7 月 1 日 07:48:44 以来失败(结果:退出代码); 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(code=exited,status=0/SUCCESS)

【问题讨论】:

    标签: linux nginx centos


    【解决方案1】:

    我终于自己找到了解决办法

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

    然后我用

    user nobody; // in my nginx.conf
    

    这解决了我的问题

    感谢大家的帮助!

    【讨论】:

      【解决方案2】:
      • 卸载

        yum remove nginx

      • 安装

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

      【讨论】:

      • 当我使用 sudo yum purge nginx nginx-common nginx-full
        它显示
        加载的插件:fastestmirror 没有这样的命令:purge。请使用 /bin/yum --help
      • 但无法再次启动 nginx 服务
      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2016-11-01
      • 1970-01-01
      • 2018-09-13
      • 1970-01-01
      • 2016-07-12
      • 2013-09-06
      • 2017-11-22
      相关资源
      最近更新 更多