nginx proxy to confluence doesn´t work

Hi,

 

I´ve setup a external server (freeBSD) and installed nginx there to proxy all traffic for confluence.domain.tld to atlassian.domain.tld:8090/confluence. And this doensn´t work :(

Context-path is setup according to this how-to:
https://confluence.atlassian.com/confkb/how-to-change-the-confluence-context-path-707985922.html

And that works great :)

Now nginx comes into play. I configured ist like this:

https://confluence.atlassian.com/confkb/how-to-use-nginx-to-proxy-requests-for-confluence-313459790.html

But nginx passes nothing to the given address. All that I receive is the hello-Page from nginx.

This is the config i used:

 

server {
listen 80;
server_name confluence.domain.tld
client_max_body 100m;

location / {
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://atlassian.domain.tld:8090/confluence;

DNS Record are working. Any ideas?

 

4 answers

0 vote
Ann Worley Atlassian Team Oct 17, 2017

If you set up the context path /confluence the location in NGINX needs to be location /confluence.

If you are using 6.x or above you will need a proxy location directive for Synchrony as well, to support collaborative editing. Here is the example from the guide you linked, please compare to your configuration to find any discrepancies: How to use NGINX to proxy requests for Confluence

server {
listen www.example.com:80;
server_name www.example.com;
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";
}

Hi Ann,

 

thanks for your reply. I can´t find any detailed instructions for setting up synchrony's contextpath. 

In the Guide I can find the following statement:

 

For Confluence 6.0 or later we also need to include Synchrony, the service that powers collaborative editing, which listens on port 8091 with the context path /synchrony.

 

But where do I configure synchrony? Where is the installation Path of it?

And the nginx proxy_pass still doesn´t work. All I get with the sub.domain.tld ist welcome Page from nginx.

 

 :(

Ann Worley Atlassian Team Oct 23, 2017

I am sorry to hear that the proxy isn't directing requests as expected.

Synchrony already has the context path /synchrony and port 8091. It is installed with Confluence 6.x or during an upgrade to 6.x or higher.

Please post your new nginx config, in case I can spot something that would explain the issue.

OK, I understand Synchrony and its context path - thanks.

 

Here is my nginx.conf that should proxy "confluence.domain.de" to "atlassian.domain.de:8090/confluence"

 

worker_processes 4;
pid /var/run/nginx.pid;


events {
worker_connections 768;
}


http {
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 65;
types_hash_max_size 2048;

include mime.types;
default_type application/octet-stream;

access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;

server {
listen webproxy.domain.de:80;
server_name webproxy.domain.de;

root /usr/local/www/nginx;
index index.html index.htm;

location / {
try_files $uri &uri/ /index.html;
}
}



server {
listen 80;
server_name confluence.domain.de
client_max_body 100m;

location /confluence {
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://atlassian.domain.de:8090;
}

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://atlassian.domain:8091/synchrony;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "Upgrade";
}
}
}

 

DNS-Records for both, the origin and target adress are set and can be resolved by the machine that runs nginx 

Ann Worley Atlassian Team Oct 24, 2017

I am not an nginx expert but I did see something that may be an issue. The example config uses the context path on the proxy_pass parameter, where yours doesn't:

Example:

 proxy_pass http://localhost:8090/confluence;

Your config:

proxy_pass http://atlassian.domain.de:8090; 

Please try with the context path on the proxy_pass line and let me know what happens. 

add the context path makes no difference in how the requested site behaves in the browser :(

Ann Worley Atlassian Team Oct 25, 2017

A colleague with more nginx experience suggests that you try with one server block:

http {
 sendfile on;
 tcp_nopush on;
 tcp_nodelay on;
 keepalive_timeout 65;
 types_hash_max_size 2048;

include mime.types;
 default_type application/octet-stream;

access_log /var/log/nginx/access.log;
 error_log /var/log/nginx/error.log;

server {
 listen 80;
 server_name confluence.domain.de
 client_max_body 100m;

location /confluence {
 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://atlassian.domain.de: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://atlassian.domain:8091/synchrony;
 proxy_http_version 1.1;
 proxy_set_header Upgrade $http_upgrade;
 proxy_set_header Connection "Upgrade";
 }
 }
}

 Another colleague suggested we check the proxy logs as they may give us a better hint.

I look forward to hearing how it works with one server block as well as anything you find in the nginx logs.

Suggest an answer

Log in or Sign up to answer
Atlassian Community Anniversary

Happy Anniversary, Atlassian Community!

This community is celebrating its one-year anniversary and Atlassian co-founder Mike Cannon-Brookes has all the feels.

Read more
Community showcase
Kesha Thillainayagam
Posted Apr 13, 2018 in Confluence

We want to hear how your non-technical teams are using Confluence!

Hi Community! Kesha (kay-sha) from the Confluence marketing team here! Can you share stories with us on how your non-technical (think Marketing, Sales, HR, legal, etc.) teams are using Confluen...

370 views 20 10
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you