Hi!
I'm new to whole nginx thing and trying to figure out how to get this thing work. Here's the what:
- 1 DNS
- 2 nginx servers
- 1 app server
and why:
Nginx is supposed to be used to load balance traffic coming from internet and redirect it to app server. At this moment there is only 1 app server because I wanted to simplify things and get things to work first. Later there are supposed to be 2 app servers.
Anyway, app server name is advertised(not sure if correct word) to DNS. DNS record points to nginx load balancers. Load balancer points to app server and to a specific port.
- I've made sure that DNS setting is correct. Using nslookup to query DNS name of app server I get 2 different IPs (=nginx server IPs).
- Nginx config is very simple, here's the code (same in both nginx servers):
--- BEGIN ---
upstream SERVER_NAME {
server IP:PORT;
}
server {
listen 80;
location / {
proxy_pass http://SERVER_NAME;
}
}
--- END ---
^ that server IP is the app servers IP
- I've tried telnetting from nginx servers to app server port and established successfully connection.
- I've checked that the app is running in the app server.
So all in all, everything seems to be working OK, except it is not. When I try to use browser (Chrome, Firefox, Edge) and navigate to servers page I get "site not found" error. I really can't figure out where I went wrong. Also when checked nginx log files I get no indication of successful connection to server.
Any and all help would be GREATLY appreciated. Thanks in advance!
I'm new to whole nginx thing and trying to figure out how to get this thing work. Here's the what:
- 1 DNS
- 2 nginx servers
- 1 app server
and why:
Nginx is supposed to be used to load balance traffic coming from internet and redirect it to app server. At this moment there is only 1 app server because I wanted to simplify things and get things to work first. Later there are supposed to be 2 app servers.
Anyway, app server name is advertised(not sure if correct word) to DNS. DNS record points to nginx load balancers. Load balancer points to app server and to a specific port.
- I've made sure that DNS setting is correct. Using nslookup to query DNS name of app server I get 2 different IPs (=nginx server IPs).
- Nginx config is very simple, here's the code (same in both nginx servers):
--- BEGIN ---
upstream SERVER_NAME {
server IP:PORT;
}
server {
listen 80;
location / {
proxy_pass http://SERVER_NAME;
}
}
--- END ---
^ that server IP is the app servers IP
- I've tried telnetting from nginx servers to app server port and established successfully connection.
- I've checked that the app is running in the app server.
So all in all, everything seems to be working OK, except it is not. When I try to use browser (Chrome, Firefox, Edge) and navigate to servers page I get "site not found" error. I really can't figure out where I went wrong. Also when checked nginx log files I get no indication of successful connection to server.
Any and all help would be GREATLY appreciated. Thanks in advance!