0

This is my nginx.conf on cs2:

user  nginx;
worker_processes  1;

error_log  /var/log/nginx/error.log;
error_log  /var/log/nginx/error.log  notice;
error_log  /var/log/nginx/error.log  info;

pid        /var/run/nginx.pid;

events {
    worker_connections  1024;
}

http {
        upstream web-spr {
                server      web-ws:80 max_fails=1 fail_timeout=10s;
                server      web-ws.atcs1.dom.com:80 max_fails=1 fail_timeout=10s;
        }

        server  {
                listen  interface:80;
                server_name     web-ws.atcs2.dom.com;
                location /service {
                        proxy_pass http://web-spr;
                }
        }

And this is my /etc/hosts on cs2:

154.25.39.126  web-ws.atcs1.dom.com        # Remote Server IP on some other network
192.168.0.1    web-ws                      # eth0:1 (vitual interface) IP
10.10.107.235  interface                   # eth0 IP

And finally this is /etc/hosts on my local PC:

208.225.249.12  web-ws.atcs2.dom.com
154.25.39.126   web-ws.atcs1.dom.com

Now the problem is that on web-ws:80 and 'web-ws.atcs1.dom.com:80` I have a up and running tomcat servers.

But when I access it from my local pc via http://web-ws.atcs2.dom.com, for one hit it responds properly but on next hit it gives out a 404 error. I mean all the alternative hits return desired result and otherwise fails with 404 Error.

Error Logs show nothing.

Any clue on this? What wrong I am going with?

Tariq
  • 101
  • 2

1 Answers1

0

If 1 hit every 2 requests works properly and the other is 404, it highly looks to me like 1 upstream server is working properly and the other is returning 404.

Remember nginx tries upstream servers in a round-robin fasion by default.

Since you do not see any 5xx error, it suggests there is no server error. 404 is a client error, which means a request could not be served because nothing matched it.

I would suggest to have a look at your tomcat servers. Since you can connect to 154.25.39.126 fro your machine, it seems this one looks properly. Try to dig into the one listening on the cs2 machine local interface.

I do not see anything involving any nginx trouble so far.

Bernard Rosset
  • 1,323
  • 12
  • 24