This page last changed on May 23, 2006 by david.soul@atlassian.com.

Introduction

The Apache web server is often used in front of an application server to improve performance in high-load environments. Mod_proxy simply redirects requests for certain URLs to another web server, so it typically requires no additional configuration on the application server.

This page documents a very common configuration request: configuring JIRA and Confluence on two Apache virtual hosts, running on different application servers. This is just a special case of mod_proxy configuration.

You can use virtual hosts in your application server if you want to run JIRA and Confluence on the same application server. There is a sample configuration for Tomcat you can use after configuring Apache.

Apache configuration

For this configuration to work properly, the application paths must be the same on both the application servers and the web server. For both JIRA and Confluence below, this is /.

JIRA external URL http://jira.example.com/
JIRA application server URL http://jira-app-server.internal.example.com:8080/
Confluence external URL http://confluence.example.com/
Confluence application server URL http://confluence-app-server.internal.example.com:8080/

Add the following to your Apache httpd.conf:

# Put this after the other LoadModule directives
LoadModule proxy_module /usr/lib/apache2/modules/mod_proxy.so
LoadModule proxy_http_module /usr/lib/apache2/modules/mod_proxy_http.so

# Put this with your other VirtualHosts, or at the bottom of the file
NameVirtualHost *
<VirtualHost *>
    ServerName confluence.example.com
    
    ProxyRequests Off
    <Proxy *>
        Order deny,allow
        Allow from all
    </Proxy>
    
    ProxyPass / http://confluence-app-server.internal.example.com:8080/
    ProxyPassReverse / http://confluence-app-server.internal.example.com:8080/
    <Location />
        Order allow,deny
        Allow from all
    </Location>
</VirtualHost>
<VirtualHost *>
    ServerName jira.example.com
    
    ProxyRequests Off
    <Proxy *>
        Order deny,allow
        Allow from all
    </Proxy>
    
    ProxyPass / http://jira-app-server.internal.example.com:8080/
    ProxyPassReverse / http://jira-app-server.internal.example.com:8080/
    <Location />
        Order allow,deny
        Allow from all
    </Location>
</VirtualHost>

Points to note:

  • ProxyPass and ProxyPassReverse directives send traffic from the web server to your application server.
  • The application path is the same on the application server and on the web server (both are /).
  • Because the above configuration uses name-based virtual hosting, you must configure your DNS server to point both names (jira.example.com, confluence.example.com) to your web server.

More information

For different ways to configure mod_proxy, see Using Apache with mod_proxy.

If you use Tomcat, mod_jk provides a different way of connecting Apache via AJP. You can also use the above configuration with just one application server if you use Tomcat's virtual hosts.

Hi

I'm wondering if anyone else has set up a single confluence Space to look like an Apache vhost...

I'm successfully running Confluence 2.3.1 (listening on localhost:8080) behind Apache 2.0.52 (listening on *:80) with the following directives.

ProxyPass               /       http://localhost:8080/
ProxyPassReverse        /       http://localhost:8080/

This shows the whole confluence site, and works fine.

I've then set up a second vhost, and proxy directed it to a single space, but ran into problems that various resources on the page are not in the space.  So I added a number of extra proxy config lines.  To wit:

    ProxyPass               /decorators        http://localhost:8080/decorators
    ProxyPass               /download        http://localhost:8080/download
    ProxyPass               /images            http://localhost:8080/images
    ProxyPass               /plugins        http://localhost:8080/plugins
    ProxyPass               /display/downtown    http://localhost:8080/display/SPACENAME/
    ProxyPass               /            http://localhost:8080/display/SPACENAME/

    ProxyPassReverse        /            http://localhost:8080/display/SPACENAME/

It basically seems to be working, as in the links work, which is good, but the ProxyPassReverse URL rewriting doesn't seem to be working - URLs show up as http://vhost.domain.name/display/SPACENAME/PageName.

The other thing is that links to pages in other spaces don't work.  Obviously I have a lot to learn about apache's proxy/rewriting modules... 

Just wondering if anyone else has dont this before, and what their solution was..

 cheers - andy

Posted by andyjones at Mar 22, 2007 02:52
Document generated by Confluence on Mar 22, 2007 20:58