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

alexlwilson August 3, 2015

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
rrudnicki
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
August 3, 2015

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

0 votes
alexlwilson August 3, 2015

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