This page is read only. You can view the source, but not change it. Ask your administrator if you think this is wrong. {{tag>centos systemd service nginx}} ====== Create the systemd service ====== ===== Create the service file ===== <sxh bash>vim /lib/systemd/system/nginx.service</sxh> ===== service file contents ===== <sxh bash> [Unit] Description=The nginx HTTP and reverse proxy server After=syslog.target network.target remote-fs.target nss-lookup.target [Service] Type=forking PIDFile=/var/run/nginx/nginx.pid # Nginx will fail to start if /var/run/nginx/nginx.pid already exists but has the wrong # SELinux context. This might happen when running `nginx -t` from the cmdline. # https://bugzilla.redhat.com/show_bug.cgi?id=1268621 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 </sxh>