Tomcat config is incorrect when behind a nginx
Asked by wen yao:

When i try to access [https://test.conf.com](https://test.conf.com?) always got the below info. And i try to resolve it but failed when using :

<https://confluence.atlassian.com/doc/running-confluence-behind-nginx-with-ssl-858772080.html>

=================================

**Tomcat config is incorrect**

The Tomcat server.xml has an incorrect configuration:

**scheme** should be 'https'  
**proxyName** should be 'test.conf.com'  
**proxyPort** should be '443'

============================

Below is nginx config:

server {

listen 443 default ssl;  
ssl_certificate test.crt;   
ssl_certificate_key test.key;

ssl_session_timeout 5m;

ssl_protocols TLSv1 TLSv1.1 TLSv1.2;  
ssl_ciphers HIGH:!aNULL:!MD5;  
ssl_prefer_server_ciphers on;

<br />

location / {  
client_max_body_size 100m;  
proxy_set_header X-Forwarded-Host $host;  
proxy_set_header X-Forwarded-Server $host;  
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;  
proxy_pass http://localhost:8090;  
}  
location /confluence {  
client_max_body_size 100m;  
proxy_set_header X-Forwarded-Host $host;  
proxy_set_header X-Forwarded-Server $host;  
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;  
proxy_pass http://localhost:8090/confluence;  
}  
location /synchrony {  
proxy_set_header X-Forwarded-Host $host;  
proxy_set_header X-Forwarded-Server $host;  
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;  
proxy_pass http://localhost:8091/synchrony;  
proxy_http_version 1.1;  
proxy_set_header Upgrade $http_upgrade;  
proxy_set_header Connection "Upgrade";  
}  
}

below is server.xml:

\<Server port="8000" shutdown="SHUTDOWN" debug="0"\>  
\<Service name="Tomcat-Standalone"\>  
\<Connector port="8090" connectionTimeout="20000" redirectPort="8443"  
maxThreads="48" minSpareThreads="10"  
enableLookups="false" acceptCount="10" debug="0" URIEncoding="UTF-8"  
protocol="org.apache.coyote.http11.Http11NioProtocol"  
scheme="https" proxyName="test.conf.com" proxyPort="443"/\>

\<Engine name="Standalone" defaultHost="localhost" debug="0"\>  
\<Host name="localhost" debug="0" appBase="webapps" unpackWARs="true" autoDeploy="false" startStopThreads="4"\>  
\<Context path="" docBase="../confluence" debug="0" reloadable="false" useHttpOnly="true"\>  
\<!-- Logging configuration for Confluence is specified in confluence/WEB-INF/classes/log4j.properties --\>  
\<Manager pathname=""/\>  
\<Valve className="org.apache.catalina.valves.StuckThreadDetectionValve" threshold="60"/\>  
\</Context\>

\<Context path="${confluence.context.path}/synchrony-proxy" docBase="../synchrony-proxy" debug="0"  
reloadable="false" useHttpOnly="true"\>  
\<Valve className="org.apache.catalina.valves.StuckThreadDetectionValve" threshold="60"/\>  
\</Context\>  
\</Host\>  
\</Engine\>  
\</Service\>  
\</Server\>


Answers:
author: Gonchik Tsymzhitov
body: Hi!

Looks like you config is correct.

Please, remove this block

```
location /confluence {
client_max_body_size 100m;
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-Server $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass http://localhost:8090/confluence;
}
```

because you context path is "". hence /confluence unrelated config.

Cheers,

Gonchik Tsymzhitov


Tags: nginx

ssl

tomcat