Linux/Ubuntu: nginx: Configuration to send request to another server by servername

PHOTO EMBED

Mon Aug 29 2022 14:53:22 GMT+0000 (UTC)

Saved by @marcopinero #bash

upstream newserver {
  server 172.16.0.1:80;  # this is new server, by IP address
}

server {
  listen 80;
  server_name subdomain.site.com;
  location / {
    proxy_set_header Host $host;
    proxy_pass http://newserver;
  }
}
content_copyCOPY