Skip to content

Instantly share code, notes, and snippets.

@lovelock
Created January 21, 2015 02:25
Show Gist options
  • Save lovelock/17db85bfbd65aa15fa4c to your computer and use it in GitHub Desktop.
Save lovelock/17db85bfbd65aa15fa4c to your computer and use it in GitHub Desktop.
systemd service file for nginx
[Unit]
Description=The nginx HTTP and reverse proxy server
After=sys.og.target network.target remote-fs.target nss-lookup.target
[Service]
Type=forking
PIDFile=/usr/local/openresty/nginx/logs/nginx.pid
ExecStartPre=/usr/local/openresty/nginx/sbin/nginx -t
ExecStart=/usr/local/openresty/nginx/sbin/nginx
ExecReload=/bin/kill -s HUP $MAINPID
ExecStop=/bin/kill -s QUIT $MAINPID
PrivateTmp=true
[Install]
WantedBy=multi-user.target
@lovelock
Copy link
Author

this file should be found in /usr/lib/systemd/system directory if you install nginx from distribution binary mirrors. When you build nginx from source, then the file is very useful.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment