I have 2 Java App running at ports 8084 and 8085 Url for the server - http://127.0.0.1:8085/hello/adi
NGINX Configuration ::
/etc/nginx/conf.d/default.conf -
upstream my-app1 {
server 127.0.0.1:8085;
}
upstream my-app2 {
server 0.0.0.0:8084;
}
server {
listen 80;
server_name localhost;
location / {
root /usr/share/nginx/html;
index index.html index.htm;
}
location /hello {
proxy_pass http://my-app1/hello/adi;
}
location /helloin {
proxy_pass http://my-app2/helloin/helloin/adi;
}
}
/etc/nginx/nginx.conf -
user nginx;
worker_processes 1;
error_log /var/log/nginx/error.log warn;
user nginx;
worker_processes 1;
error_log /var/log/nginx/error.log warn;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
}
http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
access_log /var/log/nginx/access.log main;
sendfile on;
#tcp_nopush on;
I am seeing this error :
[error] 7#7: *1 connect() failed (111: Connection refused) while connecting to upstream, client: 172.17.0.1, server: localhost, request: “GET /hello HTTP/1.1”, upstream: “http://127.0.0.1:8085/hello/adi”, host: “0.0.0.0:8080”