Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Passenger with NginX not registered as service in Fedora

I am running Fedora 16 32bit and I installed passenger with nginx (option 1 during installation, everything was handled for me). Installation went ok, but nginx is not registered as service.

The only way I can run it is directly through /opt/nginx/sbin/nginx. There is no possibility to run it via /etc/init.d/nginx

Is there any way how to register it as service?

like image 534
rootpd Avatar asked Mar 20 '12 07:03

rootpd


1 Answers

Create file /etc/systemd/system/nginx.service with the content:

[Unit]
Description=Nginx
After=syslog.target network.target

[Service]
Type=forking
ExecStart=/usr/local/nginx/sbin/nginx
ExecReload=/usr/local/nginx/sbin/nginx -s reload

[Install]
WantedBy=multi-user.target

After that you can control it with:

sudo systemctl stop|start|restart nginx.service

or

sudo service nginx stop|start|restart

To enable nginx to start on boot you can run sudo systemctl enable nginx.service.

like image 199
Ion Br. Avatar answered Nov 16 '22 00:11

Ion Br.