Mrugesh
Mrugesh

Reputation: 4517

is server name required for only backend for nginx setup

I am trying to setup nginx on my ubuntu machine. I went through the tutorial about how to setup nginx. In that tutorial there is code as shown below:

server {
    listen 80;

    server_name example.com;

    location / {
        proxy_pass http://localhost:8080;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection 'upgrade';
        proxy_set_header Host $host;
        proxy_cache_bypass $http_upgrade;
    }
}

Here, as I have my backend on aws. So what should I put in the field server_name?

Upvotes: 0

Views: 63

Answers (1)

Rahul Soni
Rahul Soni

Reputation: 4968

Have your server_name set to a public IP if you don't have a name. Your request needs to reach the server. Without a name, you will not be able to have two different server blocks on the same port.

Upvotes: 1

Related Questions