Nginx Add to Windows service

Source: Internet
Author: User

In the Windows platform, the Nginx registration to the service, but also can start, stop and restart methods, the Internet did not find a good way.

That being the case, the only way to write the program is

Use C # to write, interested in can download source code to change: source Download

or download the compiled program directly, you need the. NET Framework 2.0 or. NET Framework 4.0 environment support

Download: program Download

Feature description, using your own defined bat script to implement custom Windows services, should be available for most applications such as nginx such as the inconvenient use of Windows services

Directory Structure and Description:

Install.bat: Install the service script, open with Notepad, modify "Set My=nginxservice", let my value be the service name you want to register, such as "Hello"

Mystart.bat: This script is the script that executes when the service starts, and can implement its own startup logic

Mystop.bat: This script is a script that executes when the service is stopped, and can implement its own stop logic

NginxService.exe: This file name needs to be modified, that is, to modify the service name you need to register, such as the above is configured as "Hello", then modified to "Hello.exe", as for why, see the source logic.

2.0 and 4.0 directories: exe that holds the NginxService.exe corresponding to the. NET Framework 2.0 and. NET Framework 4.0 environments

Nginx added to the Windows service is simple, you can change nothing, only need to install the corresponding. NET Framework Environment

Copy the four files to Nginx.exe's sibling directory, double-click Run Install.bat to install, and after installation you will see a service named "Nginxservice" added to the service, that is, it can start and restart Nginx service.

Hey, sometimes the way to solve problems is so simple.

If you have any questions, you may not be able to reply. [email protected], or [email protected]

Nginx Add to 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.