<div dir="ltr">please check your proxy_pass parameter, it should point to your tomcat endpoint: <a href="http://www.mkyong.com/nginx/nginx-apache-tomcat-configuration-example/">http://www.mkyong.com/nginx/nginx-apache-tomcat-configuration-example/</a><div><br></div><div>hope this helps.</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Apr 20, 2016 at 7:19 PM, gischethans <span dir="ltr"><<a href="mailto:nginx-forum@forum.nginx.org" target="_blank">nginx-forum@forum.nginx.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">I have a Tomcat server serving a web application and I have a Nginx server<br>
running in front of it as a reverse proxy. Both the servers are on Intranet,<br>
in the same domain network. The issue I am facing is, the tomcat server is<br>
accessible through both IP addresses - if I use the Nginx IP, it redirects<br>
to the Tomcat FQDN (expected) but if I ping using the FQDN<br>
<a href="http://tomcat.domain.com" rel="noreferrer" target="_blank">tomcat.domain.com</a>, it reveals the real IP of the Tomcat server and not that<br>
of Nginx server. Effectively, my Nginx server is not serving any purpose. I<br>
was suggested to firewall the Tomcat instance, but based on my findings from<br>
different forums, limiting Tomcat to listen to localhost seemed to be the<br>
way to go. In order to prevent Tomcat from listening to other IPs, I added<br>
"address=127.0.0.1" to the connector configuration. The entire connector<br>
block is like this -<br>
<br>
<Connector port="8080"<br>
address="127.0.0.1"<br>
maxThreads="150"<br>
minSpareThreads="25"<br>
connectionTimeout="20000"<br>
enableLookups="false"<br>
maxHttpHeaderSize="8192"<br>
protocol="HTTP/1.1"<br>
useBodyEncodingForURI="true"<br>
redirectPort="8443"<br>
acceptCount="100"<br>
disableUploadTimeout="true"<br>
proxyName=<FQDN><br>
proxyPort="80"/><br>
<br>
In the Nginx server, I have these lines for the server configuration.<br>
<br>
server {<br>
listen 80 default_server;<br>
listen [::]:80 default_server ipv6only=on;<br>
<br>
server_name <FQDN>;<br>
location / {<br>
proxy_pass <FQDN>;<br>
proxy_set_header X-Forwarded-Host $host;<br>
proxy_set_header X-Forwarded-Server $host;<br>
proxy_set_header X-Forwarded-for $proxy_add_x_forwarded_for;<br>
}<br>
}<br>
Now, if I try to use the FQDN to access the web application, Chrome reports<br>
ERR_CONNECTION_REFUSED. My Nginx configuration seems to be the culprit based<br>
on what I understood. How can it be corrected?<br>
<br>
Posted at Nginx Forum: <a href="https://forum.nginx.org/read.php?2,266297,266297#msg-266297" rel="noreferrer" target="_blank">https://forum.nginx.org/read.php?2,266297,266297#msg-266297</a><br>
<br>
_______________________________________________<br>
nginx mailing list<br>
<a href="mailto:nginx@nginx.org">nginx@nginx.org</a><br>
<a href="http://mailman.nginx.org/mailman/listinfo/nginx" rel="noreferrer" target="_blank">http://mailman.nginx.org/mailman/listinfo/nginx</a><br>
</blockquote></div><br></div>