0

I have to start multiple nginx servers, how can i make a sites-enabled with the server to automatically listen on the server own ip? Like if i can call this_ip in this example

server {
    listen 80;
    server_name $this_ip;
                location / {
        proxy_pass http://localhost:5000;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header Host $http_host;
        proxy_set_header X-Forwarded-Proto $scheme;
        proxy_buffering off;
     }
 }

1 Answers1

0

Have you tried using server_name $hostname?

I just perfomed a quick test, changing the ip of a server with that setting and it worked perfectly.

An overview over nginx variables: https://nginx.org/en/docs/varindex.html

cetteup
  • 166
  • 5