Enable Nginx to boot from Windows service

Source: Internet
Author: User

# Start: f:\nginx-0.9.4> nginx.exe   # View status: F:\nginx-0.9.4> tasklist/fi "imagename eq nginx.exe"   # Stop Now: F:\nginx-0.9.4> nginx.exe-s Stop   # Stop (smooth exit) after all sessions: F:\nginx-0.9.4> Nginx.exe-s quit   # reload config file # (When the configuration file is modified, he starts a new worker, stopping the original worker, which is transparent to the user) f:\nginx-0.9.4> nginx.exe-s Reload   # reopen log file f:\nginx-0.9.4> nginx.exe-s reopen     Unfortunately, Nginx.ex E yourself regardless of registering Windows Server, you need to start/stop yourself manually under the command line. With Google Baidu, found a good article-"Nginx Windows Service", but also found in the article a good program: "Windows service Wrapper"-Used to encapsulate your program into Windows services. You can download it here. http://www.7scs.com/down/57652.html   How to use: 1. Download the latest version of the Windows Service Wrapper program, such as the name I downloaded is "Winsw-1.9-bin.exe",     then, name it as you want (for example: "Myapp.exe", of course, You can also not rename) 2. Copy the renamed Myapp.exe to the Nginx installation directory (I am here "F:\nginx-0.9.4") 3. Create a Windows Service wrapper XML configuration file in the same directory, the name must match the name used when the first step is renamed (for example, I am "myapp.xml" here,   if you do not rename it, it should be " Winsw-1.9-bin.xml ")     file contents are as follows:   <?xml version=" 1.0 "encoding="UTF-8 "?> <service>   <id>nginx</id>   <name>nginx</name>   < description>nginx</description>   <executable>F:\nginx-0.9.4\nginx.exe</executable>   <logpath>F:\nginx-0.9.4\</logpath>   <logmode>roll</logmode>   <depend ></depend>   <startargument>-p f:\nginx-0.9.4</startargument>   <stopargument> -P F:\nginx-0.9.4-s stop</stopargument> </service> 4. At the command line, execute the following command to install it as a Windows service. f:\nginx-0.9.4> myapp.exe install   OK, at this point, completed, confirm: My Computer right---management------Is there an nginx? Start up, access in the browser http://localhost confirm, then stop the service, and then visit  http://localhost confirm.   ADD: The command format for Windows Servcie wrapper is as follows:   # installation Service cmd:\> myapp.exe install   # Uninstall service cmd:\> myapp.exe Uni Nstall   # Start service cmd:\> myapp.exe start   # stop service cmd:\> myapp.exe stop

Allow Nginx to boot from Windows service

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.