Reputation: 1671
We have 2 DNS names (call them D1 and D2) pointing to the same IP address (call it A). At A there are 2 webservers on different ports (say 8081 and 8082). I need to configure that the 2 names point to the 2 webservers eg D1 points A:8081 and D2 pints to A:8082. I think this is simple but have not been able to work out how to configure Apache or Nginx as reverse-proxy to do this. (This is just so users don't have to type a port number.)
Upvotes: 1
Views: 524
Reputation: 49692
You have two DNS names, so that will be implemented in Nginx as two server
blocks with different server_name
statements. See this document for details.
For example:
server {
server_name d1.example.com;
location / {
proxy_pass http://127.0.0.1:8081;
}
}
server {
server_name d2.example.com;
location / {
proxy_pass http://127.0.0.1:8082;
}
}
Upvotes: 1