简体   繁体   English

如果我在centos服务器中删除/ etc / nginx,请重新安装nginx如何再次重新安装它我在centos和nginx中是新用户

[英]reinstall nginx if i delete /etc/nginx in centos server how to reinstall it again i am new in centos and nginx

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.conf文件中做了一些错误,无法还原
so it tried to remove my nginx and reconfigure it 所以它试图删除我的nginx并重新配置它
so i used these step which is given in the link to delete my nginx 所以我用链接中给出的这些步骤删除了我的nginx
http://www.ehowstuff.com/how-to-remove-uninstall-nginx-on-centos-7-rhel-7-oracle-linux-7/ http://www.ehowstuff.com/how-to-remove-uninstall-nginx-on-centos-7-rhel-7-oracle-linux-7/
then i use 然后我用
yum remove nginx and again reinstall it yum删除nginx并再次重新安装
but when i try 但是当我尝试
sudo systemctl start nginx or [root@lotto nginx]# service nginx start sudo systemctl start nginx[root @ lotto nginx]#服务nginx start
its showing 其显示

Job for nginx.service failed because the control process exit enter code here ed with error code. nginx.service的作业失败,因为控制进程出口enter code here了错误代码。 See "systemctl status nginx.service" and "journalctl -xe" for details . 有关详细信息,请参见“ systemctl status nginx.service”和“ journalctl -xe”
when i am using 当我使用
[root@lotto nginx]# systemctl status nginx.service [root @ lotto nginx]#systemctl状态nginx.service
showing 显示

nginx.service - The nginx HTTP and reverse proxy server nginx.service-Nginx HTTP和反向代理服务器
Loaded: loaded (/usr/lib/systemd/system/nginx.service; enabled; vendor preset: disabled) 已加载:已加载(/usr/lib/systemd/system/nginx.service;已启用;供应商预设:已禁用)
Active: failed (Result: exit-code) since Fri 2016-07-01 07:48:44 EDT; 活动:自周五2016-07-01 07:48:44美国东部时间以来失败(结果:退出代码); 18s ago Process: 30832 ExecStartPre=/usr/sbin/nginx -t (code=exited, status=1/FAILURE) 18年前进程:30832 ExecStartPre = / usr / sbin / nginx -t(代码=已退出,状态= 1 /失败)
Process: 30830 ExecStartPre=/usr/bin/rm -f /run/nginx.pid (code=exited, status=0/SUCCESS) 进程:30830 ExecStartPre = / usr / bin / rm -f /run/nginx.pid(代码=已退出,状态= 0 /成功)
Main PID: 14307 (code=exited, status=0/SUCCESS) 主PID:14307(代码=退出,状态= 0 /成功)

Jul 01 07:48:44 lotto systemd[1]: Starting The nginx HTTP and reverse proxy server... Jul 01 07:48:44 lotto nginx[30832]: nginx: [emerg] getpwnam("nginx") failed in /etc/nginx/nginx.conf:5 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: configuration file /etc/nginx/nginx.conf test failed Jul 01 07:48:44 Lotto Nginx [30832]:Nginx:配置文件/etc/nginx/nginx.conf测试失败
Jul 01 07:48:44 lotto systemd[1]: nginx.service: control process exited, code=exited status=1 Jul 01 07:48:44 lotto systemd [1]:nginx.service:控制进程已退出,代码=退出状态= 1
Jul 01 07:48:44 lotto systemd[1]: Failed to start The nginx HTTP and reverse proxy server. Jul 01 07:48:44 lotto systemd [1]:无法启动Nginx HTTP和反向代理服务器。
Jul 01 07:48:44 lotto systemd[1]: Unit nginx.service entered failed state. Jul 01 07:48:44 lotto systemd [1]:单元nginx.service进入失败状态。 Jul 01 07:48:44 lotto systemd[1]: nginx.service failed. Jul 01 07:48:44 lotto systemd [1]:nginx.service失败。
and [root@lotto nginx]# journalctl -xe [root @ lotto nginx]#journalctl -xe

nginx.service - The nginx HTTP and reverse proxy server nginx.service-Nginx HTTP和反向代理服务器
Loaded: loaded (/usr/lib/systemd/system/nginx.service; enabled; vendor preset: disabled) 已加载:已加载(/usr/lib/systemd/system/nginx.service;已启用;供应商预设:已禁用)
Active: failed (Result: exit-code) since Fri 2016-07-01 07:48:44 EDT; 活动:自周五2016-07-01 07:48:44美国东部时间以来失败(结果:退出代码); 18s ago 18s前
Process: 30832 ExecStartPre=/usr/sbin/nginx -t (code=exited, status=1/FAILURE) 进程:30832 ExecStartPre = / usr / sbin / nginx -t(代码=已退出,状态= 1 /失败)
Process: 30830 ExecStartPre=/usr/bin/rm -f /run/nginx.pid (code=exited, status=0/SUCCESS) 进程:30830 ExecStartPre = / usr / bin / rm -f /run/nginx.pid(代码=已退出,状态= 0 /成功)
Main PID: 14307 (code=exited, status=0/SUCCESS) 主PID:14307(代码=退出,状态= 0 /成功)

  • uninstall 卸载

    yum remove nginx

  • install 安装

    In CentOS , you should using yum install ; 在CentOS中,您应该使用yum install instead of apt-get install in Ubuntu. 而不是在Ubuntu中进行apt-get install

at last I found out the solutions by my self 最后我自己找到了解决方案

I used nginx -t which shows that I don't have any syntax error in my code 我使用了nginx -t ,它表明我的代码中没有语法错误

Then I use 然后我用

user nobody; // in my nginx.conf

This solved my problem 这解决了我的问题

Thanks everyone for your help! 谢谢大家的帮助!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM