I have JIRA and Nginx running on the same server with Nginx installed to
serve as a reverse proxy. From what I learnt from various sources, in
the
Tomcat server.xml file, I must add an address=“127.0.0.1” attribute so
that
Tomcat does not listen to outside IPs. But once I add that to my 8080
and
8443 connectors, things stop working i.e., the JIRA site becomes
inaccessible. Browser displays Connection refused / connection timed out
errors. Trying to access the site through curl gives me 502 Bad gateway
error. I have also checked the Nginx error log which shows this -
connect() failed (111: Connection refused) while connecting to upstream,
client: , server: , request: “GET / HTTP/1.1”,
upstream:
“http://:8080/”, host:
Here is my nginx.conf
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;
keepalive_timeout 65;
#gzip on;
include /etc/nginx/conf.d/*.conf;
include /etc/nginx/sites-enabled/*;
}
and the entire content of the file for sites-enabled
server {
listen 80;
server_name test-pcrdesk.ingrnet.com;
location / {
proxy_pass http://<IP>:8080/; #Here I have tried the
real IP
of the server, localhost, FQDN with and without port 8080, almost
anything I
could think of
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $host;
}
}
Here is server.xml file configuration for Tomcat.
<Connector port=“8080”
address=“127.0.0.1”
maxThreads=“150”
minSpareThreads=“25”
connectionTimeout=“20000”
enableLookups=“false”
maxHttpHeaderSize=“8192”
protocol=“HTTP/1.1”
useBodyEncodingForURI=“true”
acceptCount=“100”
redirectPort=“8443”
disableUploadTimeout=“true”
proxyName=
proxyPort=“80”/>
<Connector port=“8443”
address=“127.0.0.1”
SSLEnabled=“true”
acceptCount=“100”
clientAuth=“false”
connectionTimeout=“20000”
disableUploadTimeout=“true”
enableLookups=“false”
keyAlias=
keystoreFile=
keystorePass=
keystoreType=“JKS”
maxHttpHeaderSize=“8192”
maxSpareThreads=“75”
maxThreads=“150”
minSpareThreads=“25”
protocol=“org.apache.coyote.http11.Http11Protocol”
scheme=“https”
secure=“true”
sslProtocol=“TLS”
useBodyEncodingForURI=“true”/>
What is wrong with my configuration?
Posted at Nginx Forum: