Reputation: 453
My requirement is to load balance two ESB web services running in two separate nodes (10.110.6.29, 10.110.6.45)
I'm using nginx and is installed in 10.110.6.45. Basically when I send a request to 10.110.6.45 (port 80)
it should be equally load balanced to both nodes.
Below is the /etc/nginx/nginx.conf.
user www;
worker_processes 1;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
upstream esbhnbwso2.hnb.lk{
server 10.110.6.45:8280;
server 10.110.6.29:8280;
}
server {
listen 80;
server_name localhost;
location / {
proxy_pass http://esbhnbwso2.hnb.lk;
proxy_http_version 1.1;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}
}
when I try to call the service http://10.110.6.45/hnbceftapi
I'm getting the below nginx page.
What am I doing wrong? any help would be very much appreciated.
<html>
<head>
<meta content="HTML Tidy for Java (vers. 27 Sep 2004), see www.w3.org" name="generator"/>
<title>404 Not Found</title>
</head>
<body bgcolor="white">
<center>
<h1>404 Not Found</h1>
</center>
<hr/>
<center>nginx/1.14.2</center>
</body>
</html>
Upvotes: 1
Views: 174
Reputation: 453
After some internet reading, I was able to make nginx work. These were my finding, thought of sharing these.
I had to enable linux internal firewall with the below commands.
firewall-cmd --permanent --zone=public --add-service=http
firewall-cmd --permanent --zone=public --add-service=https
These commands basically will create a public zone and allow http(80), https(443) traffic.
Can verify the allowed ports by running below command.
firewall-cmd --list-ports
Had to run the below command to allow the httpd - http daemon (Apache web server which nginx runs) to make http communication.
setsebool -P httpd_can_network_connect 1
These configuration were required because the distibution I was working on was a Security Enhanced Linux (SELinux). I'm not a system admin hence I was not aware of these configurations.
Upvotes: 1