If nginx is installed in Windows, it is found that it is not running as a service, that is, when the user logs out,Program
Will terminate. Therefore, nginx must be run as a service.
Suppose nginx is installed under c: \ nginx:
1. download the software service registration tool srvany.exe and instsrv.exe, which are stored in the C: \ nginx \ directory.
Http://wesoho.com/soft/down/srvany.rar
2. Install the nginx service, switch the command line to c: \ nginx \, and execute the following command
Instsrv nginx c: \ nginx \ srvany.exeNo error occurred while initializing srvany.exe
3. Under c: \ nginx \, edit an nginx. reg file (In this step, I encountered a problem and the import failed.)
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE \ SYSTEM \ CurrentControlSet \ Services \ nginx \ Parameters]
"Application" = "C: \ nginx \ nginx.exe"
"Appparameters" = ""
"Appdirectory" = "C: \ nginx \\"
5. Associate services with programs and execute commands
Regedit/s nginx. Reg
Solution to the above execution failure: RunRegeditOpen the registry and add it directly under [HKEY_LOCAL_MACHINE \ SYSTEM \ CurrentControlSet \ Services \ nginxParametersAnd then manually create the registry values of the three strings.Application appparameters appdirectory
6. Edit the startup nginx script start-nginx.bat (close the script without changing) to run the program as a service
@ Echo off
Net stop nginx
Net start nginx
Exit
After the above steps, the nginx service is successfully started. In addition, a graphical interface tool srvinstw. EXE is added to the service.