FAQ

Page Discussion History

Difference between revisions of "FedoraSystemdServiceFile"

(Created page with "= Fedora Nginx systemd service file = Should work on Fedora, OpenSUSE, Arch Linux. Tested on Fedora 16 and 17. Save this file as /lib/systemd/system/nginx.service <geshi lan...")
 
m
 
(2 intermediate revisions by one user not shown)
Line 1: Line 1:
 
= Fedora Nginx systemd service file =
 
= Fedora Nginx systemd service file =
 
Should work on Fedora, OpenSUSE, Arch Linux. Tested on Fedora 16 and 17.
 
Should work on Fedora, OpenSUSE, Arch Linux. Tested on Fedora 16 and 17.
 +
 +
The location of the PIDFile and the nginx binary may be different depending on how nginx was compiled.
  
 
Save this file as /lib/systemd/system/nginx.service
 
Save this file as /lib/systemd/system/nginx.service
  
 
<geshi lang="bash">
 
<geshi lang="bash">
#!/bin/sh
 
 
[Unit]
 
[Unit]
Description=A high performance web server and reverse proxy server
+
Description=The nginx HTTP and reverse proxy server
 
After=syslog.target network.target remote-fs.target nss-lookup.target
 
After=syslog.target network.target remote-fs.target nss-lookup.target
  
Line 15: Line 16:
 
ExecStartPre=/usr/sbin/nginx -t
 
ExecStartPre=/usr/sbin/nginx -t
 
ExecStart=/usr/sbin/nginx
 
ExecStart=/usr/sbin/nginx
ExecReload=/usr/sbin/nginx -s reload
+
ExecReload=/bin/kill -s HUP $MAINPID
ExecStop=/usr/sbin/nginx -s quit
+
ExecStop=/bin/kill -s QUIT $MAINPID
 
PrivateTmp=true
 
PrivateTmp=true
  

Latest revision as of 20:15, 16 May 2012

Fedora Nginx systemd service file

Should work on Fedora, OpenSUSE, Arch Linux. Tested on Fedora 16 and 17.

The location of the PIDFile and the nginx binary may be different depending on how nginx was compiled.

Save this file as /lib/systemd/system/nginx.service

[Unit]
Description=The nginx HTTP and reverse proxy server
After=syslog.target network.target remote-fs.target nss-lookup.target
 
[Service]
Type=forking
PIDFile=/run/nginx.pid
ExecStartPre=/usr/sbin/nginx -t
ExecStart=/usr/sbin/nginx
ExecReload=/bin/kill -s HUP $MAINPID
ExecStop=/bin/kill -s QUIT $MAINPID
PrivateTmp=true
 
[Install]
WantedBy=multi-user.target