Question
Is it possible to use private ip address instead of domain for nginx load balancer setup?
Hi, I try to create one nginx load balancer and 1 apache php backend server by refer to
nginx load balancing.
I want to limit all public access to the backend server. Only load balancer can accept public access (like http or https). Then I want my load balancer pass the query to the backend server via private network.
So I setup both servers with private network. I successfully query the nginx welcome page from load balancer. I also successfully get the apache welcome page from backend before I restrict public access with digitalocean firewall.
Then I setup the upstream directive for nginx like what it showed from the article except I use the backend server’s Private IP instead of a domain name in config file like:
upstream backend{
server 10.130.20.01; <== in the article this is backend1.example.com
}
server {
…
location / {
proxy_pass http://backend;
}
}
At this time I assume I should see the apache page when I visit the load balancer public IP but it did not show up. I wonder if this is because of the backend private IP which I place in the nginx config file? Is it possible to use ip instead of domain to setup nginx load balancer? Thanks
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.
×