Skip to content

stef03codes/nginx-proxy

Repository files navigation

Nginx Reverse Proxy

Starting Instructions

First you should install Nginx locally on your machine. Then you should change the configuration in the nginx.conf file with the configuration below:

worker_processes 1;

events {
    worker_connections 1024;
}

http {

    include mime.types;

    upstream nodejs_cluster {
        least_conn;
        server 127.0.0.1:5001;
        server 127.0.0.1:5002;
        server 127.0.0.1:5003;
    }

    server {
        listen 8080;
        server_name localhost;
        
        location / {
            proxy_pass http://nodejs_cluster;
            proxy_set_header Host $host;
            proxy_set_header X-Real-IP $remote_addr;
        }
    }
}

You can also start the nginx in a docker container, the configuration of the nginx.conf file is still the same.

After you configured nginx all you need to do is to start all of the instances configured in the docker-compose.yml file, with the following command:

docker-compose up -d

To stop and remove the running instances you normally use the command:

docker-compose down

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •