Install Nginx correctly
Add Nginx to systemctl
My NGINX installation directory is: /service/nginx-1.14.0 (please modify the service file according to your own configuration)
Added nginx.service file
The configuration is as follows:
The [Unit] section is mainly a description of the service, including Description and After, Description is used to describe the service, and After is used to describe the service category
The [Service] part is the key to the service, which is the setting of some specific running parameters of the service, where Type=forking is the form of background running, PIDFile is the file path where the PID is stored, ExecStart is the specific run command of the service, ExecReload is the restart command, ExecStop is the stop command, PrivateTmp=True indicates that an independent temporary space is allocated to the service, Note: [ Service] part of the start, restart, and stop commands all require the absolute path to be used, and an error will be reported if the relative path is used!
The [Install] section is a setting related to the installation of the service, which can be set to multi-user
Set Nginx to boot up
Test launch Nginx
Other orders systemctl reload nginx.service // restart systemctl stop nginx.service // stop systemctl stop nginx.service // stop systemctl status nginx.service // to view the status
Finally, attach the nginx.service file:
Tourists, if you want to see the hidden content of this post, please Reply
|