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 votes

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 Join to answer
Community showcase
Sarah Schuster
Posted Jan 29, 2018 in Jira

What are common themes you've seen across successful & failed Jira Software implementations?

Hey everyone! My name is Sarah Schuster, and I'm a Customer Success Manager in Atlassian specializing in Jira Software Cloud. Over the next few weeks I will be posting discussion topics (8 total) to ...

2,802 views 11 18
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
Atlassian Team Tour

Join us on the Team Tour

We're bringing product updates and pro tips on teamwork to ten cities around the world.

Save your spot