Centos 7.1 + Nginx issue


I just install Centos 7.1 and i want to use Nginx 1.8 on it. This settup it works great on Centos6 but i run in some issue now.

One of them is restarting nginx over webmin/virtualmin.
When i try to restart i`m getting:

Failed to re-start service : sh: /etc/init.d/nginx: No such file or directory

And this is big issue because on every task that’s need nginx to restart for example adding new domain i need to perform manual nginx restart over ssh.

Any idea/solution how to fix this?

Your /etc/init.d/nginx script is missing.
Use the following instructions to create one:

This link does not work, and almost all of the distributions moved from init to systemd so it is normal that file not to exist.
Maybe virtualmin needs to check both locations?

The rackspace link is down - I did my own research on the matter because I was having the same problem.

Here is a working example of the file you need:


This worked for me, don’t forget to set the permissions on the newly created “nginx” file to 0755.

I have run into this issue repeatedly. It can occur when Virtualmin/Webmin is updated.
Another way to fix this is to go to
Virtualmin>Features and Plugins and click on NGINX to open the VM config form.
That should show the improper settings which need to be changed:
/etc/init.d/nginx start change to: service nginx start
/etc/init.d/nginx stop change to: service nginx stop
/etc/init.d/nginx restart change to: service nginx restart

Go to Server Status or another area to restart NGINX - it should work.

Cloug4G has the right answer (though I would use “systemctl restart nginx”, instead of service, but either works).

This will be fixed in the next release of the virtualmin-nginx module for new installs, but it’ll have to fixed manually for existing installations.

Don’t create an initscript, as suggested in guya’s post. It might work, but it’s completely unnecessary. Just correcting the commands Virtualmin runs to start and stop and restart nginx is the right thing.

Joe, I agree - Both work but it is better to get into the habit of using the systemctl command (start/stop/restart) application (nginx) command structure.