how do I set up Jira at a subdomain?

Kris W July 28, 2011

I have Jira working at example.com:8090. However, I'd like to set it up at jira.example.com.

 

I've tried a basic VirtualHosts addition:

 

<VirtualHost 72.3.139.6:80>
ServerName jira.example.com
ProxyPass / http://localhost:8090/<br< a=""> /> ProxyPassReverse / http://localhost:8090/<br< a=""> /> <Proxy http://localhost:8090/><br< a=""> /> Order deny,allow
Allow from all
</Proxy>
ErrorLog logs/requests.example.com-error_log
CustomLog logs/requests.example.com-access_log common
</VirtualHost>

which gets me most of the way there. I can see the login page at jira.example.com, but I get this error message:

 

Dashboard Diagnostics: Mismatched URL Hostname

JIRA is reporting that it is running on the hostname 'localhost', which does not match the hostname used to run these diagnostics, 'requests.lmpartnership.org'. This is known to cause JIRA to construct URLs using the incorrect hostname, which will result in errors in the dashboard, among other issues.

The most common cause of this is the use of a reverse-proxy HTTP server (often Apache or IIS) in front of the application server running JIRA. While this configuration is supported, some additional setup might be necessary in order to ensure that JIRA detects the correct hostname.

The following articles describe the issue and the steps you should take to ensure that your web server and app server are configured correctly:

Gadgets do not display correctly after upgrade to JIRA 4.0
http://confluence.atlassian.com/display/JIRAKB/Gadgets+do+not+display+correctly+after+upgrade+to+JIRA+4.0<br< a=""> />
Integrating JIRA with Apache

http://confluence.atlassian.com/display/JIRA/Integrating+JIRA+with+Apache<br< a=""> />
Integrating JIRA with Apache using SSL
http://confluence.atlassian.com/display/JIRA/Integrating+JIRA+with+Apache+using+SSL<br< a=""> />
If you believe this diagnosis is in error, or you have any other questions, please contact Atlassian Support.

 

I've looked at all those pages, but none of them seem to help.

I also tried the advice on this page:

http://confluence.atlassian.com/display/CONF31/Using+Apache+with+virtual+hosts+and+mod_proxy

 

But that gives me a 502 Proxy Error:

 

Proxy Error

The proxy server received an invalid response from an upstream server.
The proxy server could not handle the request GET /.

Reason: DNS lookup failure for: jira-app-server.internal.example.com

 

How do I set this up so I don't have the mismatched hostname issue?

5 answers

2 votes
bhuwanchawla August 4, 2011

I had the same problem that you did and here's how I fixed it:

  1. /etc/httpd/conf.d/vhost.conf

<VirtualHost bugs.mysite.com:80>

ServerName bugs.mysite.com

ProxyRequests Off

<Proxy *>

Order deny,allow

Allow from all

</Proxy>

ProxyPass / http://localhost:8080/

ProxyPassReverse / http://localhost:8080/

</VirtualHost>

  1. /opt/atlassian/jira/conf/server.xml
Add the following:
<Server port="8005" shutdown="SHUTDOWN">
<Service name="Catalina">
<Connector port="8080"
proxyName="bugs.mysite.com" proxyPort="80" />
Here's what my final server.xml file looks like:
<Service name="Catalina">
<Connector port="8080"
maxThreads="150"
minSpareThreads="25"
maxSpareThreads="75"
connectionTimeout="20000"
enableLookups="false"
maxHttpHeaderSize="8192"
protocol="HTTP/1.1"
useBodyEncodingForURI="true"
redirectPort="8443"
acceptCount="100"
disableUploadTimeout="true"
proxyName="bugs.domain.com" proxyPort="80"/>
Restart Apache and Tomcat (jira) and that should do it....

Bhuwan

bhuwanchawla August 4, 2011

BTW this was base 4.4 Jira install.

horacioespinosa June 19, 2018

This redirect all my subdomains to JIRA :( how i cant prevent this issue?

2 votes
AlexH
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
July 29, 2011

I use jira.company.net and wiki.company.net for our installation of jira/confluence. End users talk to apache on port 80 which handles all the work of proxying to JIRA running on port 8181

Here's a simplified version of the VirtualHost for JIRA, you'll need to substitute your own IPs and ports. Once you get this working you can start getting creative and adding additional optimizations via mod_rewrite or maybe even google's mod_pagespeed.

<VirtualHost 10.x.x.x:80>
ServerName jira.company.net
ServerAlias jira
DocumentRoot /opt/jira
ErrorLog /opt/jira/apache/logs/jira-error_log
CustomLog /opt/jira/apache/logs/jira-access_log common

RewriteEngine on
# if the maintenance file exists, redirect to the "maintenance" url
RewriteCond %{DOCUMENT_ROOT}/maintenance -f
RewriteRule (.*) http://statichtml.company.net/jira/ [P,L]

# otherwise act as a proxy to jira which is running on port 8181
ProxyPreserveHost on
ProxyPass / http://10.x.x.x:8181/<br< a=""> /> ProxyPassReverse / http://10.x.x.x:8181/<br< a=""> /></VirtualHost>
Kris W August 3, 2011

Hi Alex,

Thanks for providing your VirtualHost example - much appreciated.

Still not quite working for me, though -

when I try going to jira.example.com, I get redirected to

example.com/secure/Dashboard.jspa

with a 404 error.

Any suggestions?

Thanks again!

0 votes
lenybernard October 4, 2012

Hi,

I just installed jira in my server as a subdomain : jira.example.com

I followed those topic's instructions which help !

Everything went fine but the home widgets did not rendered properly and I'm getting this hint on homepage :

We've detected a potential problem with JIRA's Dashboard configuration.

Dashboard Diagnostics: Mismatched URL Port

JIRA is reporting that it is running on the port '8080', which does not match the hostname used to run these diagnostics, '80'. This is known to cause JIRA to construct URLs using the incorrect port, which will result in errors in the dashboard, among other issues.

The most common cause of this is the use of a reverse-proxy HTTP server (often Apache or IIS) in front of the application server running JIRA. While this configuration is supported, some additional setup might be necessary in order to ensure that JIRA detects the correct port.

The following articles describe the issue and the steps you should take to ensure that your web server and app server are configured correctly:

If you believe this diagnosis is in error, or you have any other questions, please contact Atlassian Support.

I dont't really understand what to do and I'd appreciate a little help :)

Thank you !

0 votes
twong_atlassian
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
July 28, 2011

Hi Kiminca,

Can you check the following:

1. Serverbase url- Admin > general config-- Ensure that it references the right place.

2. Connector element in the server.xml (or jira.xml if you're using an ear/war). Make sure that you've defined the proxyHost and proxyPort attributes as per http://confluence.atlassian.com/display/JIRA/Integrating+JIRA+with+Apache. Might help me out if you could post the connector element.

Kris W July 29, 2011
Hi Tim,

Thanks for the quick reply!

Server Base URL in Admin is http://example.com:8090 .

I had not added the proxyHost and proxyPort attributes when I posted this question. I have now. Here's the connector info:

<Connector port="8090"
maxThreads="150"
[snip]
protocol="HTTP/1.1"
useBodyEncodingForURI="true"
redirectPort="8443"
acceptCount="100"
disableUploadTimeout="true"
proxyName="example.com" proxyPort="80"
/>

I restarted Jira and the server, but I'm still getting the Proxy Error.

(By the way, the 600 char limit makes it hard to provide this info.)
0 votes
Jeremy Largman
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
July 28, 2011

Yikes - sorry about the formatting of this question! I've tried to clean it up a bit. I'm working on trying to work out the bugs in editing here in Answers.

As for your question, I'll hunt for a colleague who's better at networking than I am...

Sanket Nagare September 28, 2021

Hi team, can I add a subdomain on Hosted Jira server ?

Jira Server is not hosted on any Cloud Platform. it's a normal Linux Server.

Suggest an answer

Log in or Sign up to answer