1

Completely new to nginx, coming from Apache.

I have a simple multiple proxy to nodejs setup put together from a few online resources and the config looks like this:


server{
    listen 80;
    server_name dev1.domain.net;

    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header Host $host;
    proxy_http_version 1.1;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection "upgrade";


    location /  {
       proxy_pass http://127.0.0.1:3000;
    }
    location /other  {
       proxy_pass http://127.0.0.1:3001;
    }
}

Each new reverse proxy I have added as a new location.

Coming from apache, it feels a little too easy...

Is this the most efficient & recommended way of creating new reverse proxies in a single file?

John C
  • 13
  • 2

1 Answers1

0

To clear up the confusion

nginx is a line based configuration. that means for each location (I. e. sub directory) needs to be repeat the proxy pass in case of different locations and or configuration.

So it is correct the example of the origin question

djdomi
  • 1,377
  • 3
  • 10
  • 19