By default Jira runs on a certain port, in this example at port 8090. It is accessible by http://example.com:8090/. This tutorial will make the Jira application available at port 80 with jira as path like: http://example.com/jira. Two configurations are possible, with or without SSL.
Make sure you perform all actions as root.
Change the file /opt/atlassian/jira/conf/server.xml file with:
nano /opt/atlassian/jira/conf/server.xml
Search for the part <Service name=”Catalina”> and make it look like:
This part is added:
nano /etc/nginx/conf.d/example.com.conf
server { server_name example.com; location ^~ /jira { 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; } }
Continue by following the chapter Steps for both “Without SSL” and “With SSL”.
Change the file /opt/atlassian/jira/conf/server.xml file with:
nano /opt/atlassian/jira/conf/server.xml
Search for the part <Service name=”Catalina”> and make it look like:
This part is added:
nano /etc/nginx/conf.d/example.com.conf
server { server_name example.com; listen 80; listen 443 ssl; ssl_certificate /etc/ssl/certs/example_com.pem; ssl_certificate_key /etc/ssl/private/example_com.key; location ^~ /jira { if ($ssl_protocol = "") { return 301 https://$server_name$request_uri; } 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; } }
Continue by following the chapter below Steps for both “Without SSL” and “With SSL”.
Make the node “host” in the file above look like below. The value “/jira” is added to the path attribute of the node “Context”.
Restart Jira:
service jira stop service jira start
Reload nginx
service nginx reload
Everything should be working now if you visit http://example.com/jira. You will probably get a message at the top of the page that you visit Jira from another URL than the set base URL. The proposed link to change the base URL will be: http://example.com/jira/secure/admin/EditApplicationProperties!default.jspa. Change the base URL there from http://example.com:8090 to http://example.com/jira or https://example.com/jira.