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
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
Julia Dillon
Posted Apr 17, 2018 in Jira

Tell us how your team runs on Jira!

Hey Atlassian Community! Today we are launching a bunch of customer stories about the amazing work teams, like Dropbox and Twilio, are doing with Jira. You can check out the stories here. The thi...

798 views 2 19
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