Welcome! Log In Create A New Profile

Advanced

Systemctl Start Nginx command unable to start the service

Posted by jepoytengco 
Systemctl Start Nginx command unable to start the service
September 19, 2016 10:23PM
I tried to setup a Centos machine (tried 7.0 Core and 7.2 Core). After the OS has been installed performed

yum install epel-release and yum install nginx

I can see that the default path of the nginx.conf is under

/etc/nginx/nginx.conf

Tried to modify the path by removing the original path (/etc/nginx/nginx.conf) to a new path (/usr/local/nginx/config/nginx.conf) but after modifying the path, the service turned to "Failed" (code=exited, status=1/FAILURE) in red font color.

What I did was revert back to the original path (/etc/nginx/nginx.conf) and directly modified the nginx.conf

vi /etc/nginx.nginx.conf

tested the nginx by typing in: nginx -t, both ok and successful but this time around the service still showed up the same error message.

Tried to make a some research and all pointing out to a script or service but I'm pretty sure after testing the nginx -t, it should work now. No idea if there are other factors for this service to run.

Thanks
Jeff
Re: Systemctl Start Nginx command unable to start the service
October 24, 2016 12:17PM
Is your issue only with automatic start after a boot?

Can you start the service subsequently with e.g. sudo systemctl start nginx

If so, systemctl is trying to start nginx initially before all its prerequisites are ready (don't know what exactly).

Insert

ExecStartPre=/usr/bin/sleep 20

before

ExecStartPre=/usr/sbin/nginx -t -c /etc/nginx/nginx.conf

in

/lib/systemd/system/nginx.service

NB you may need to redo this after some yum updates...
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 198
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 500 on July 15, 2024
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready