Problem with Confluence behind Nginx
Asked by mkrupniewski-blueowl:

I installed Confluence on my own VPS server (in /var/www/atlassian/confluence/ directory), I also configured SSL. In order to connect Confluence to my own domain I did everything according to [this manual.](https://confluence.atlassian.com/doc/running-confluence-behind-nginx-with-ssl-858772080.html.)

Unfortunately, when I enter my subdomain I get information about error 404 (some simple HTML from Confluence exists), in the browser console a lot of errors about missing resources and strange URLs (e.g. <https://my.subdomain.com/s/a5b9cfe2e93be163560b16bfe0aa76f7-CDN/gsrvpz/8301/s1264995706/8.3.5/_/download/batch/com.atlassian.auiplugin:split_aui.splitchunk.vendors--57570d46fb/com.atlassian.auiplugin:split_aui.splitchunk.vendors--57570d46fb.js?locale=en-GB>).

I restarted Confluence and NGINX and PHP-FPM and it didn't work.

I've been on it for a couple of hours and I don't know what to do anymore.  
Below is the nginx configuration file:

server {  
listen my.subdomain.com:80;  
server_name my.subdomain.com [www.my.subdomain.com](http://www.my.subdomain.com);

listen 443 ssl;  
ssl_certificate /etc/letsencrypt/live/my.subdomain.com/fullchain.pem;  
ssl_certificate_key /etc/letsencrypt/live/my.subdomain.com/privkey.pem;

ssl_session_timeout 5m;

ssl_protocols TLSv1 TLSv1.1 TLSv1.2;  
ssl_ciphers 'ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA:ECDHE-RSA-AES256-SHA:ECDHE-ECDSA-DES-CBC3-SHA:ECDHE-RSA-DES-CBC3-SHA:EDH-RSA-DES-CBC3-SHA:AES128-GCM-SHA256:AES256-GCM-SHA384:AES128-SHA256:AES256-SHA256:AES128-SHA:AES256-SHA:DES-CBC3-SHA:!DSS';  
ssl_prefer_server_ciphers on;

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/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";  
}  
}  
server {  
if ($host = [www.my.subdomain.com](http://www.my.subdomain.com)) {  
return 301 https://$host$request_uri;  
} # managed by Certbot

<br />

if ($host = my.subdomain.com) {  
return 301 https://$host$request_uri;  
} # managed by Certbot  
}

<br />

and server.xml fragment:

\<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" secure="true" proxyName="my.subdomain.com" proxyPort="443"/\>

<br />

\<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\>


Answers:
author: Jeff Turner
body: I think the nginx line:

proxy_pass http://localhost:8090/confluence

should be:

proxy_pass http://localhost:8090

to match \<Context path="" ....\>

comments: author: mkrupniewski-blueowl
body: it helps, thank you!


author: Thomas Brenna
body: [@Jeff Turner](/t5/user/viewprofilepage/user-id/747456)Thank you!

I was having a similar issue, and had no clue what it was.

I'd removed the context from location / (i.e. gone from location /confluence =\> /), but didn't catch the context in the proxy_pass directive.


Tags: confluence-server

nginx

proxy

server

ubuntu