Centos 7.1 + Nginx issue

7 posts / 0 new
Last post
#1 Tue, 09/08/2015 - 06:26
sumi

Centos 7.1 + Nginx issue

Hello,

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?

Fri, 01/01/2016 - 13:34
guya

Your /etc/init.d/nginx script is missing. Use the following instructions to create one: http://www.rackspace.com/knowledge_center/article/centos-adding-an-nginx...

Wed, 05/25/2016 - 14:58
pennywise

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?

Mon, 07/25/2016 - 18:04
cquinndesign
cquinndesign's picture

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:

https://www.nginx.com/resources/wiki/start/topics/examples/redhatnginxinit/

This worked for me, don't forget to set the permissions on the newly created "nginx" file to 0755.

Sat, 09/16/2017 - 13:14
Cloud4G

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.

Sat, 09/16/2017 - 17:10
Joe
Joe's picture

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.

--

Check out the forum guidelines!

Sun, 09/17/2017 - 08:47
Cloud4G

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.

Topic locked