nginx sets system service startup
-
To download nginx, just download it directly from the official website
-
Baidu nssm
-
After downloading and unzipping, I put nssm and nginx in the same folder.
-
Unzip nssm. Depending on your system, if it is 32-bit, copy nssm.exe from the win32 folder. If it is 64-bit, copy nssm.exe from the win64 folder. I copied it to nginx.
-
cmd, switch to the nginx path
-
Run the command in this directory:
nssm install My_Nginx
path: is the path of nginx.exe, directory: is the path of the nginx folder;
here I should write path:F:\nginx\nginx-1.16.1\nginx.exe
;
directory:F:\nginx\nginx-1.16.1
-
When the install service button is clicked, the following image will pop up, indicating that the installation is successful.
-
Enter the command at the command line
services.msc
-
Display on the service list page:
and set startup, right-click Properties -> Set Automatic -
Delete nginx service command
sc delete 服务名称