How to Install and Run the Nginx Server on Windows

Featured Image Windows 10 Nginx Combination

Nginx is a web server that is very popular with Linux and BSD systems. It can also be installed on Windows 10. However, there are a few performance limitations in Windows that have not been mitigated so far, but the developers will address these problems in a future release. To install and run Nginx successfully on Windows, follow the steps below.

Download the Nginx Server

There are many download versions of Nginx for Windows, and Nginx recommends using the “mainline version.” However, you will not find any issues if you download its most recent stable version for Windows.

Select the version you want and download its zip file to your PC.

Nginx Windows Mainline Version Download

As a first step, you need to extract the new folder. You can use 7-zip, WinRAR or any other popular compression software.

Nginx Windows Extract Zip File

After extracting the file contents in the original folder, you have to move the entire folder that came with the built-in download copy into the “Program Files.” We can either move or cut-paste this extracted folder.

Nginx Windows Program Files

We will run Nginx from this location as a default web service program.

Installing Nginx

To install and run Nginx, select and double-click the Nginx.exe file. It has now been activated for further use. You may run into a Windows Defender block screen while running the Nginx server, which has to be allowed by you.

Nginx Windows Run Program

In the next step, you need to verify whether the installation has been successful. For this, go to your default browser and type localhost. Microsoft Edge is the browser used in the below example. If you see a screen saying the Nginx web server is successfully installed and working, it means there were no problems with your Nginx installation in Windows.

Nginx Windows Browser Localhost

To stop Nginx, you can end it from the Task Manager window.

Nginx Windows End Task

Running Nginx on Your Windows PC

To run Nginx, you have to use Internet Information Services (IIS), which is a Microsoft web server that serves requested HTML pages or files. You can enable it in “Turn Windows Features On or Off” in the Control Panel. Check the required fields for “Web Management Tools” and “IIS Management Console.”

Nginx Windows Iis Enabled

It will take a while for IIS to be enabled on your computer as the changes are applied.

Nginx Windows Iis Applying Changes

You can open IIS Manager directly from the Start menu. Always open it in Administrator mode.

Nginx Windows Iis Manager Start Menu

Here, you will be able to access the default website, which is usually located at “inetpub wwwroot.” This is also known as the web application root. You can look for it in File Explorer through a simple search.

Nginx Windows Inetpub Root Folder

It is helpful to change the physical path of this root to a more desirable folder. I created a new “Work” folder in C:\ and changed the physical path to “C:\Work.” When you double-click on the “default web site” option in IIS Manager, it should lead to this new folder. Alternatively, you can right-click the menu and select “explore” for the same result.

Nginx Windows Iis Manager Root Folder

After this, go to the Nginx folder that you renamed in the Program files. Click “Conf” and select “nginx.conf.” This file can be edited using the Notepad++ text editor, but you can use any other editor such as Atom or Visual Studio Code.

Edit Nginx Conf File With Notepadplusplus

In Notepad++, find the location of the root and change it from the default html.

Nginx Windows Location Root

As shown here, change the root to the edited physical path which we discussed above.

Nginx Windows Location Root Changed

You can edit the index.html file in the root folder in a separate tab. Change the text to what you want the web server to display on the screen.

Nginx Windows Text Changed Index.html

Exit the Nginx.exe program using “End Task.” Open and run the “nginx.exe” file in Admin mode.

Type localhost in a browser window. The Nginx web server will highlight the edits you made.

Nginx Windows Runing Program

Example Application of Nginx in Windows

The Nginx resources site has a full list of web server applications which you can use to run various applications on Windows PC.

For example, you can use Nginx in Windows to link to a webpage such as a customer login page. Once you make the configuration changes in the “nginx.conf” file, your end users will be able to access the login page on their end.

Go back to the “nginx.conf” file shared in the previous section. Instead of “localhost,” you need a domain name for the server to access. “index.html” is a command used to point to any static html page.

Nginx Windows Put Domain Name

In the next step, go to “location” and modify the text using an “api,” followed by a proxy server added with an “http” ping. This should point to any login page you want this page to direct to.

Nginx Windows Proxy Server Login

Save the file and run the “Nginx.exe” program in Admin mode. For this login page to look nice to the end user, you should have previously configured the web server in an IDE program like Eclipse.

Frequently Asked Questions

1. What are the basic commands in operating Nginx for Windows 10?

On Windows, Nginx can be run as a standard console app. For managing it, the following simple commands are frequently used:

nginx -s stopRapid shutdown
nginx -s quitGraceful shutdown
nginx -s reloadChanging configuration, starting new worker processes with a new configuration, graceful shutdown of old worker processes
nginx -s reopenReopening log files

2. What is the role of IIS Webserver in Nginx applications in Windows?

IIS is Microsoft’s native web server which supports HTTP, HTTPS, SMTP, and other protocols, and is not enabled in Windows as default. When Nginx is installed in Windows, it handles the live traffic based on changes made in nginx.conf files. For this, Nginx has to connect internally to an enabled IIS and then cache its response for any future requests.

Nginx’s biggest strength is that it is used at the front end before high load dynamic sites. Imagine tens of thousands of your website users downloading an important video file from IIS at the same time. It can become painfully slow. if you have a very powerful front-end server like Nginx handling the traffic instead, the request is processed faster. Check the “running Nginx on Windows PC” section for more details on IIS webserver’s role.

3.How Does Nginx Run in Windows?

Nginx supports multiple applications in Windows, such as web server, load balancer, mail proxy, and more. To run them in Windows, all desired changes are affected from various strings modified in the “nginx.conf” file in the Windows installation folder. To know more about Nginx commands, including the documentation, visit this link.

Nginx is one of the leading web server companies today. Also, it is faster, can handle more concurrent issues and is reliable. To summarize, if you have a simple website you want to connect to Nginx, you can do it right now without any problems. Read on to check out the comparison of Nginx to OpenLiteSpeed.

Sayak Boral Sayak Boral

Sayak Boral is a technology writer with over ten years of experience working in different industries including semiconductors, IoT, enterprise IT, telecommunications OSS/BSS, and network security. He has been writing for MakeTechEasier on a wide range of technical topics including Windows, Android, Internet, Hardware Guides, Browsers, Software Tools, and Product Reviews.

Leave a Comment

Yeah! You've decided to leave a comment. That's fantastic! Check out our comment policy here. Let's have a personal and meaningful conversation.