How do I set up Jira and Confluence on a NGINX reverse proxy?

I'm currently setting JIRA and Confluence up and am uncertain how NGINX should be configured to act as a reverse proxy for both when they're both being accessed via port 80.

I currently have it set up as follows:

server {
	listen 80;
	server_name www.jira.example.net;
	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://localhost:8080;
		client_max_body_size 20M;
	}
}
server {
	listen 80;
	server_name www.confluence.example.net;
	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://localhost:8090;
		client_max_body_size 20M;
	}
}

As you may be able to tell, this code will not redirect correctly.

What do I need to change to allow NGINX to properly route traffic to the correct application?

2 answers

1 vote

Hi Alex, 

Looks your Confluence and JIRA are running on the same server, am I right? This might causing some issues, since you didn’t specified the root folder. Can you please try the example below and let us know if this works? 

Please, maybe you will need to change some path into my example.

In case you still face issues, please have a look on the error.log and paste the output. 

server {

    listen 127.0.0.1:80;

    server_name www.jira.example.net;

    access_log /var/log/nginx/log/JIRA.access.log main;

    error_log /var/log/nginx/log/JIRA.error.log;

        root /usr/share/nginx/html/

JIRA;

    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://localhost:8080;

        client_max_body_size 20M;

    }

}

server {

    listen 127.0.0.1:80;

    server_name www.confluence.example.net;

        access_log /var/log/nginx/log/CONFLUENCE.access.log main;

        error_log /var/log/nginx/log/CONFLUENCE.error.log;

        root /usr/share/nginx/html/CONFLUENCE;




    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://localhost:8090;

        client_max_body_size 20M;

    }

}

Cheers, 

Renato Rudnicki

I should mention that I've also adjusted both Confluence's and Jira's server.xml files as directed by the documentation provided by Atlassian.

Suggest an answer

Log in or Sign up to answer
Community showcase
Published Nov 27, 2018 in Portfolio for Jira

Introducing a new planning experience in Portfolio for Jira (Server/DC)

In the past, Portfolio for Jira required a high degree of detail–foresight that was unrealistic for many businesses to   have–in   order to produce a reliable long-term roadmap. We're tur...

2,711 views 17 21
Read article

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