High Availability with NginX on Windows


Hello, my name is Rofi and today I shall tell my story on how to setup High Availability on your own Windows laptop!

The steps shown in this tutorial is for Windows 10, as it is my main Operating System. The steps for other Operating Systems may be different.

Step 1: Install NginX

You can install the stable version of NginX .

After that, extract the folder nginx-1.16.1 and place it so it is level with your project folder like in the following illustration:

“cookies” is my django project folder

Step 2: Setting up NginX

Before we start using NginX, we need to edit some configuration files to set up the load balancer. The file you need to edit is “../nginx-1.16.1/conf/nginx.conf” and add the highlighted codes to the program like so:

Note: Before editing it is best to have a backup file for the conf file, just in case something goes wrong.

I had help with this code from my friend and . This is all you need to setup NginX. Of course there are many ways to set it up according to your own needs. In my case, I set it up so I can use two parts which are localhost:8000 and localhost:9000.

Step 3: Start NginX

To start NginX in Windows. Open a terminal in the NginX folder and type in a command like so:

If you open localhost now in your browser this is what you should see:

Step 4: Using NginX

Now open your djangoapp project and run 2 django servers. For the first one, I ran:

python manage.py runserver localhost:8000

and also:

python manage.py runserver localhost:9000

If you open localhost, now you should get the website you are trying to run. In my example, I am running one of my django projects:

Running on port 8000(left) and port 9000 (right)

To test the load balancer. You can try and stop one of the servers and see if it still runs. For example I stopped the server for localhost:8000 like so:

Stopped port 8000(left)

As you can see, the website is still running. But what if we stopped both servers? Lets see:

Stopped port 8000 (left) and port 9000(right)

It stopped running, because there aren’t any servers that can fulfill the request and NginX will display an error page.


And that is it! Easy right? Now you now know how to setup for simple high availability server with NginX on your Windows Computer. There are many tools for high availability setup like this for example “Linux Virtual Server” and many others. Feel free to explore!




Love podcasts or audiobooks? Learn on the go with our new app.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Abdurrafi Arief

Abdurrafi Arief

More from Medium

Basic Auth only for a specific domain

How to setup HTTP server with security headers using Nginx docker

Multi-containarized react appliation with nginx as a reverse proxy using docker-compose

Upload a docker image to DockerHub