Documentation for JIRA 6.3 EAP developer (EAP) releases only. Not using this? See below:
(JIRA 6.2.x documentation | JIRA OnDemand documentation | earlier versions of JIRA)

Skip to end of metadata
Go to start of metadata

Why Change JIRA's TCP Ports?

By default, JIRA uses TCP listening port 8080 (including default Apache Tomcat installations running JIRA WAR) and hence, JIRA is typically available at http://<yourserver>:8080.

If, however, an existing service running on your machine is claiming port 8080, there will be a conflict and JIRA will fail to start. You may see errors like this:

LifecycleException:  Protocol handler initialization failed: java.net.BindException: Address already in use:8080

This can be fixed by changing JIRA to use another TCP listening port (eg. 8100) and shutdown port (eg. 8015).

Changing JIRA's TCP Ports

Before you change JIRA's TCP ports, read the following:

  • Which port number should I choose? If you are not sure which port number to choose, use a tool such as netstat to determine which port numbers are free to use by JIRA. The highest port number that can be used is 65535 because it is the highest number which can be represented by an unsigned 16 bit binary number. The Internet Assigned Numbers Authority (IANA) lists the registration of commonly used port numbers for well-known Internet services, it's advisable to avoid any of those ports.
  • A note about firewalls: When you choose a port number for JIRA, bear in mind that your firewall may prevent people from connecting to JIRA based on the port number. Organisations with a local network protected by a firewall typically need to consider modifying their firewall configuration whenever they install a web-based application (such as JIRA) that is running on a new port or host. Even personal laptop and desktop machines often come with firewall software installed that necessitates the same sort of change as described above. If JIRA does not need to be accessed from outside the firewall, then no firewall configuration changes will be necessary.
  • If you are using JIRA WAR, please be aware that changing JIRA's TCP ports of the Tomcat installation running JIRA will affect any other web applications deployed to the same Tomcat installation.

You can change JIRA's TCP ports by using the JIRA configuration tool or by manually editing the server.xml file. If you installed JIRA using the 'Windows Installer', 'Linux Installer' or from an 'Archive File', you can use the JIRA configuration tool. The JIRA WAR distribution does not include this tool.

Changing JIRA's TCP Ports using the JIRA Configuration tool

  1. Start the JIRA configuration tool, see Using the JIRA Configuration Tool for instructions on where to find the tool.
  2. Click the Web Server tab.
  3. In the HTTP Port field, enter the new TCP listening port number.
  4. In the Control Port field, enter the new TCP shutdown port number.
  5. Click the Save button. Your changes are saved to the server.xml file located in the conf subdirectory of your JIRA Installation Directory.

Changing JIRA's TCP Ports by editing the server.xml file

Edit the server.xml file in the conf subdirectory of the JIRA Installation Directory (or of the Apache Tomcat installation that runs your JIRA WAR installation). The start of the file looks like:

For example, change the shutdown port from "8005" to "8015" and the listening port (i.e. in the <connector/> element) from "8080" to "8100". (See below to decide which TCP port numbers should be used for JIRA.)

Then, restart JIRA and point a browser to http://<yourserver>:8100

(minus) If you are running on a Unix server and bind the ports below 1024 (such as port 80 for example), you will need to start JIRA as root in order to successfully bind to the port.

 

RELATED TOPICS

Changing Confluence's listening ports

  • No labels

14 Comments

  1.  Lets say that instead of moving the port, you want to add an additional port to which the service is listening.  (Meaning: allow both port 8080 and 8090 to accept requests to the same server process).

    Would that simply be another "<Connector" item? And what effect would that have on the process in terms of load and how it handles requests?

    1. > Would that simply be another "<Connector" item?

      Yes.

      > And what effect would that have on the process in terms of load and how it handles requests?

      It shouldn't have any effect. It's just another possible source of incoming requests.

  2. I suggest adding a comment here about binding to a specified address using <Connector port="443" address="10.1.3.5"...> for example. This information was rather hard to come by in the documentation I could find, and it may even be worth including address="0.0.0.0' in the template/default server.xml.

    1. +1. This is exactly what I was looking for. Thanks a bunch!

  3. One way to do this on Linux without running Jira as root is to use a port re-direct.

    As root

    Install the xinetd package if it's not already installed
    # yum install xinetd

    Then create a file in "/etc/xinetd.d" to hold your redirect info
    eg :"/etc/xinetd.d/jira"

    The file should look like:
    service http
    {
         disable = no
         socket_type = stream
         user = root
         wait = no
         redirect = 127.0.0.1 8080
         log_type = FILE /tmp/jira_redirect

    }

    Then start xinetd
    # service xinetd start

    This will redirect traffic on port 80 "service http" to port 8080 on the home interface.

    This assumes that jira is already running as a non-privileged user on the default port of 8080.

    I've been running this on Jira 4 with the Green Hopper plugin and it seems to work pretty sweet.

    Let me know if anyone spots a problem.

    AM

    1. Anonymous

      Creating a xinetd script works great.  The only thing to watch out for is the log file can grow relatively big (we have ~25 users and over 6 months it grew to 13MB).

  4. Another way of achieving the same thing is to add an iptable redirection rule.

    We have done it this way, because we didn't want to add the xinit package to our standard configuration.

    These instructions were created on a Debian Lenny system.

    Create a new "if-up" script:

    Make this its content:

    #!/bin/bash
    for i in $(sudo ifconfig  | grep 'inet addr:'| grep -v '127.0.0.1' | cut -d: -f2 | awk '{ print $1}'); do
            sudo iptables -t nat -I PREROUTING 1 -d $i -p tcp --dport 80 -j DNAT --to $i:8080
            sudo iptables -t nat -I PREROUTING 1 -d $i -p tcp --dport 443 -j DNAT --to $i:8443
    done
    

    This script will take all the IPs the server is using as shown by ifconfig, and will add the redirect rules for them.

    Make the script executable:

    Create a new "if-down" script:

    Make this its content:

    #!/bin/bash
    sudo iptables -F -t nat

    This script will clear all the NAT rules by using the flush (-F) directive, when the networking is restarted.

    Adding this "if-down" script better handles cases where you changed a networking setting and the old ones are still there until a reboot. however as this does clear ALL of the NAT settings, make sure this doesn't affect other things on your setup.

    Make the script executable:

    Restart the networking service for the changes to take affect:

    Good luck (smile)

    1. Anonymous

       

      Thanks! Works, but on my Debian Squeeze change line:

       
      for i in $(sudo ifconfig  | grep 'inet addr:'| grep -v '127.0.0.1' | cut -d: -f2 | awk '{ print $1}'); do 
      for i in $(sudo ifconfig  | grep 'inet end.'| grep -v '127.0.0.1' | cut -d: -f2 | awk '{ print $1}'); do
  5. Anonymous

    I have tried doing this (changing the port to 8090) but it does not work.  I have started and stopped the service with the new port configuration and it still throws a "cannot connect" error.  This issue started happening when I installed another application that runs on port 8080.  I am not able to get into JIRA at all.  Please help.  Thanks

  6. Anonymous

    How to configure JIRA in apache config:httpd.conf under the  <Location> directive.

  7. I can get JIRA to run on port 80 on Ubuntu 11.04 without running it as root.

    Well, I take that back. On my prior install it worked, but on a fresh install, port 80 no longer works without root.

  8. Anonymous

    I added a Connector item with port="4444", copy pasted from the existing one with a different port. Then I ran "stop-jira.sh" and "start-jira.sh". "lsof -itcp" still is showing me only the old port, not the new 4444. Do I have to do something else?

  9. Anonymous

    The sentence "...you need to start JIRA as root" is misleading:

    It must be running as root. Starting "start-jira.sh" as root is not sufficient.

  10. One easy way of accessing JIRA over port 80 while keeping it running with its default behavior on port 8080 is to use Apache and mod_proxy.  On a modern Red Hat or Cent OS system this is as easy as:

    $ sudo yum install httpd

    Next, create the following file:

    File: 
      /etc/httpd/conf.d/jira.conf
    Contents:
      # Send all web traffic to JIRA
      ProxyPass       /   http://localhost:8080/
      ProxyPassReverse    /   http://localhost:8080/

    Finally, start up Apache and also set it to run automatically at boot time:

    $ sudo /etc/init.d/httpd start 
    $ sudo chkconfig httpd on

    You are all set.  JIRA will serve traffic on port 80 (via Apache) but continue to run as an unprivileged user on port 8080.

    Follow up note:

    After making the above changes, I realized I also needed to update Jira's server.xml ({JIRA home}/conf/server.xml).   Find the 8080 connector port entry and add the params:

    proxyName="{your server's hostname}"

    proxyPort="80"

    For example: (last two params)

    -------------------

    <Connector port="8080"
    maxThreads="150"
    minSpareThreads="25"
    connectionTimeout="20000"
    enableLookups="false"
    maxHttpHeaderSize="8192"
    protocol="HTTP/1.1"
    useBodyEncodingForURI="true"
    redirectPort="8443"
    acceptCount="100"
    disableUploadTimeout="true"
       proxyName="jira.somehost.com"
    proxyPort="80"/>

     

    Bounce JIRA and you should be good to go.