Nginx logo

Run Nginx As A Windows Service with FireDaemon Pro

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 has two active development branches. The "Mainline" version includes all bug fixes and new features. "Stable" includes bug fixes only. The Mainline version should be suitable for use in most cases unless you are using a third-party module. In that case, use the Stable version.

  1. Download the latest Windows Mainline or Stable version from here
  2. Extract the contents of the ZIP file to a folder on your hard disk drive. 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.

FireDaemon Pro Nginx Dedicated Server Service Program Tab

Next, click on the FireDaemon Pro Settings tab:

FireDaemon Pro Nginx service settings

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.
  • (Optional) Password / Confirm Password:  Enter the logon account's password twice.
  • (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 the FireDaemon Pro service is shut down. We have had reports that "-s quit" doesn't work. Try "-s stop" if that's the case.

Apache Solr shutdown

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.

FireDaemon Pro Services list

Step 3: Check Connectivity and Optionally Configure Windows Defender Firewall

Point your browser at the Nginx instance (e.g. http://localhost) to ensure it is up and running. If you have issues, refer to the FireDaemon Pro debug log file, Windows Event Viewer and the Nginx log files.

Nginx Local Instance Webpage

If you are having trouble connecting to Nginx ensure you configure Windows Defender Firewall to allow inbound connections on port 80 and / or 443. To do this go to the Control Panel and choose Windows Defender Firewall. Then add a new Inbound Rule as follows:

Windows Defender Firewall Inbound Rule Type

Click next then choose the program path to nginx.exe as follows:

Windows Defender Firewall Program

Click Next then choose the Action as follows:

Windows Defender Firewall Action

Click Next then choose when this rule applies:

Windows Defender Firewall Profile

Click Next then specify the rule name and description. Then click Finish. You should now be able to access Nginx via your web browser via IP address or host name.

Windows Defender Firewall Rule Name