JIRA port and Apache reverse proxy

apache-2.2jirareverse-proxy

I'm trying to set up a reverse proxy with Apache and the Tomcat instance bundled with JIRA. I've followed the directions on the JIRA wiki to a T. The site is showing up just fine at http://ourdomain:8080/jira just fine, so I know that the Tomcat server.xml file has been set correctly per their instructions.

However, I cannot get the Apache reverse proxy to work, for reasons that elude me despite considerable reading.

I'm running Apache2.2 on Ubuntu with mod_proxy and mod_proxy_http enabled, of course. The default site works fine; my site configuration is just a modified version of that. Here's my jira virtual host configuration in /etc/apache2/sites-enabled/jira:

<VirtualHost *:80>
    ServerAdmin webmaster@localhost

    ServerName ourdomain.com

    DocumentRoot /var/www
    <Directory />
        Options FollowSymLinks
        AllowOverride None
    </Directory>
    <Directory /var/www/>
        Options Indexes FollowSymLinks MultiViews
        AllowOverride None
        Order allow,deny
        allow from all
    </Directory>

    ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
    <Directory "/usr/lib/cgi-bin">
        AllowOverride None
        Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
        Order allow,deny
        Allow from all
    </Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log

# Possible values include: debug, info, notice, warn, error, crit,
    # alert, emerg.
    LogLevel warn

    CustomLog ${APACHE_LOG_DIR}/access.log combined

    Alias /doc/ "/usr/share/doc/"
    <Directory "/usr/share/doc/">
        Options Indexes MultiViews FollowSymLinks
        AllowOverride None
        Order deny,allow
        Deny from all
    Allow from 127.0.0.0/255.0.0.0 ::1/128
    </Directory>

    # JIRA Proxy Configuration
    <Proxy *>
        Order deny,allow
        Allow from all
    </Proxy>
    ProxyRequests       Off
    ProxyPreserveHost   On
    ProxyPass           /jira      http://ourdomain.com:8080/jira
    ProxyPassReverse    /jira      http://ourdomain.com:8080/jira
</VirtualHost>

When I hit the site in a browser, I get a 404 Not Found with the following (standard) text:

The requested URL /jira was not found on this server


Apache/2.2.22 (Ubuntu) Server at ourdomain.com Port 80

Meanwhile, the output from apachectl -S is:

VirtualHost configuration:
wildcard NameVirtualHosts and _default_ servers:
*:80                   is a NameVirtualHost
     default server ourdomain.com.com (/etc/apache2/sites-enabled/000-default:1)
     port 80 namevhost ourdomain.com (/etc/apache2/sites-enabled/000-default:1)
     port 80 namevhost ourdomain.com (/etc/apache2/sites-enabled/jira:1)

So I can access the site just fine at ourcomain.com:8080/jira but not at ourdomain.com/jira.

Possibly that last line indicates the issue – should it be listening on port 8080 instead, and accordingly should I be changing the vhost entry above?

Clearly I have something wrong, but I'm not seeing it; my configuration appears to match that specified by the directions on the JIRA wiki precisely. Some help would be much appreciated. I've walked through several other answers here, and had no luck with those, either.

Best Answer

You have a ServerName ourdomain.com in /etc/apache2/sites-enabled/000-default, and a ServerName ourdomain.com in /etc/apache2/sites-enabled/jira. The 000-default one takes precedence because it's alphabetically first; your jira config is not being used.

Change the ServerName ourdomain.com line in the 000-default file, or if you're not using it, then simply a2dissite default.