Nginx is a free, open-source, high-performance HTTP server and reverse proxy. It can serve many more times the traffic Apache HTTPd can and it serves many of the world's most popular websites such as Youtube, Facebook, Twitter, and more!
Nginx can be run as a Windows service using FireDaemon Pro. This allows you to start and run the application automatically when Windows boots and before login. FireDaemon Pro also allows you to start multiple instances of the server, monitoring them and automatically restarting those instances in the event they crash. FireDaemon Fusion can also be used to manage your Nginx service, plus other Windows services via your web browser.
Nginx Setup Under FireDaemon Pro
Please follow the steps below to set up an Nginx as a Windows service with FireDaemon Pro
Step 1: Download and Install Nginx
Nginx's naming convention for versions is confusing. Mainline is updated once per month and includes bug fixes and new features. Stable does not get any new features but does get major bug fixes. The Nginx devs suggest you use the mainline version for most cases but if you use a third-party module, it could be broken by a mainline update so in that case, you should use the stable version.
- Download the latest Windows mainline or stable version from here
- Extract the contents of the zip to your hard disk. For the purposes of this guide, we will use "C:\nginx-1.19.6" (the version number might be different for you).
Step 2: Set Up Nginx as a FireDaemon Pro Service
Download and install FireDaemon Pro. Double click the FireDaemon Pro icon on your desktop, then click on the New (i.e. +) button in the toolbar (or type Ctrl + N) to create a new service. Enter the information into the fields as you see below. Adjust the path names to suit your installation. Note the required parameters.
Next, click on the FireDaemon Pro Settings tab:
Enter appropriate values in the fields on the Settings tab as follows:
- (Required) Interact with Desktop: Uncheck this because Nginx does not create any window.
- (Optional) Logon Account: Enter the Windows account under which the application is to be run, e.g. the current administrator account.
- Password / Confirm Password: Enter the logon account's password twice.
- (Optional) Interact with Desktop: If this setting is enabled (default), the application's output messages can be seen in the console window on Windows Session 0. To switch to Session 0, it may be necessary to install FireDaemon Zero and ZeroInput. Alternatively, this setting may be disabled, in which case the application's messages will be hidden.
- (Optional) Priority: To allocate more CPU time to the application, select a higher scheduling priority in this field.
- (Optional) CPU Bindings: To run the application on a specific CPU, specify the appropriate CPU in this field.
Now click on the Events tab. Append a new Termination Event. This is where we set up Nginx to stop gracefully when we shut down the service.
Lastly, click the Save and Close (ie. the tick) button on the toolbar. If the service's Startup Type is set to Automatic or Automatic (Delayed-Start), it will start immediately.
Point your browser at the Nginx instance to ensure it is up and running. If you have issues, refer to the FireDaemon debug log file, Windows Event Viewer and the Nginx log files. Alternately, run the FireDaemon service interactively and turn off logging to Stderr/Stdout so you can see what is happening when the Nginx instance starts.