1
votes

i install nginx in my remote server but i done some error in my nginx.conf file and could not able to revert back
so it tried to remove my nginx and reconfigure it
so i used these step which is given in the link to delete my nginx
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
but when i try
sudo systemctl start nginx or [root@lotto nginx]# service nginx start
its showing

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.
when i am using
[root@lotto nginx]# systemctl status nginx.service
showing

nginx.service - The nginx HTTP and reverse proxy server
Loaded: loaded (/usr/lib/systemd/system/nginx.service; enabled; vendor preset: disabled)
Active: failed (Result: exit-code) since Fri 2016-07-01 07:48:44 EDT; 18s ago Process: 30832 ExecStartPre=/usr/sbin/nginx -t (code=exited, status=1/FAILURE)
Process: 30830 ExecStartPre=/usr/bin/rm -f /run/nginx.pid (code=exited, status=0/SUCCESS)
Main PID: 14307 (code=exited, status=0/SUCCESS)

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 nginx[30832]: nginx: configuration file /etc/nginx/nginx.conf test failed
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]: Failed to start The nginx HTTP and reverse proxy server.
Jul 01 07:48:44 lotto systemd[1]: Unit nginx.service entered failed state. Jul 01 07:48:44 lotto systemd[1]: nginx.service failed.
and [root@lotto nginx]# journalctl -xe

nginx.service - The nginx HTTP and reverse proxy server
Loaded: loaded (/usr/lib/systemd/system/nginx.service; enabled; vendor preset: disabled)
Active: failed (Result: exit-code) since Fri 2016-07-01 07:48:44 EDT; 18s ago
Process: 30832 ExecStartPre=/usr/sbin/nginx -t (code=exited, status=1/FAILURE)
Process: 30830 ExecStartPre=/usr/bin/rm -f /run/nginx.pid (code=exited, status=0/SUCCESS)
Main PID: 14307 (code=exited, status=0/SUCCESS)

2

2 Answers

5
votes
  • uninstall

    yum remove nginx

  • install

    In CentOS , you should using yum install ; instead of apt-get install in Ubuntu.

0
votes

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

Then I use

user nobody; // in my nginx.conf

This solved my problem

Thanks everyone for your help!