Networking NGINX

How to install NGINX and configure as a Proxy or Load balancer server on Windows/Linux machine in simple steps


NGINX is a free, open-source, high-performance HTTP server and reverse proxy, as well as an IMAP/POP3 proxy server. NGINX is known for its high performance, stability, rich feature set, simple configuration, and low resource consumption.

Download NGINX software. click here to redirect NGINX software download page.

Installation and run on window machine:

i.  Copy downloaded binaries to any folder and unzip it.
ii. to start nginx server go to the extracted folder double-click on 
    the nginx.exe binary file.
iii. By default, Nginx server is run on 80 port.
     http://localhost/ or http://
iv.  Using the ipconfig command we can find the out IP Adress.

Installation and run on Linux machine.

i.  Copy the downloaded binaries to a directory. example : /apps
ii. Extract the binaries, use below command to extract.
    tar -zxvf nginx-1.12.2.tar.gz
iii.Go to extracted folder and run below commands
    cd /apps/ginx-1.12.2
    mkdir -p /apps/nginx  (Note: you can make any directory)
    ./configure --prefix=/apps/nginx/
    make install
    cd /apps/nginx/  (application will be installed in this folder)
    ./nginx or sudo ./nginx   (to start the nginx server)
iv. By default, Nginx server is run on 80 port.
    URL: http://localhost/ or http://
    Using the ifconfig command in Linux we can find the IP Adress.
v.  To Stop NGINX, find the process id and kill the process.
    ps -ef | grep 'nginx'  (to get the process id)
    kill -9

If we want to do any configuration related changes, we can do changes in /conf/nginx.conf file.


worker_processes 1;  #We can configure no of worker processors
events {
           worker_connections 1024;  # no of connetions per process
http {    # http block
            include mime.types;
            default_type application/octet-stream;
            sendfile on;

          server {  # Servers block, we can define multiple servers blocks.
                   listen 80;  # Server listen port
                   server_name localhost; #Server Name i.e IP address

                    location / {  # Nginx location directives, we can define multiple location blocks
                            root html;
                            index index.html index.htm;
                   error_page 500 502 503 504 /50x.html; #Error pages config
                   location = /50x.html {
                    root html;

Configure NGINX as a Proxy server:

A proxy server is a server that acts as an intermediary for requests from clients seeking resources from other servers.

To pass a request to an HTTP proxied server, the proxy_pass directive is specified inside a location. For example:

location /some/path/ {  
   proxy_pass; }

Example :


location / {

Configure NGINX as a Load balancer server:

Load balancing refers to efficiently distributing incoming network traffic across a group of backend servers, also known as a server farm or server pool.


NGINX_Loadbalancer - Page 1

Below is the nginx.conf the configuration of the load balancer for round-robin fashion.

http {
        upstream rule1 {
      server {
                 listen 80;
                 location / {
                          proxy_pass http://rule1;


The ngx_http_upstream_module module is used to define groups of servers that can be referenced by the proxy_pass, fastcgi_pass, uwsgi_pass, scgi_pass, and memcached_pass directives.


One reply on “How to install NGINX and configure as a Proxy or Load balancer server on Windows/Linux machine in simple steps”

Leave a Reply

Please log in using one of these methods to post your comment: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.