Using the latest version?
JFrog Container Registry Guide


Skip to end of metadata
Go to start of metadata

Setting Up Apache HTTP Server

Setting up Apache HTTP server using AJP Protocol

 JFrog Container Registry installations do not include the AJP connector in JFrog Container Registry’s Tomcat server.xml file (i.e. under $ARTIFACTORY_HOME/tomcat/conf/server.xml).
To use AJP connector, the <Connector port="8019" protocol="AJP/1.3" sendReasonPhrase="true"/> should be added manually to the server.xml file under <Service name="Catalina">.

Upgraded JFrog Container Registry environments will be unchanged provided the server.xml file is copied over as part of the upgrade process.

Notice: AJP connector support will be removed in JFrog Container Registry's next major version (7.0).

You can set up Apache HTTP Server as a front end to JFrog Container Registry using either the HTTP or AJP protocol.

Client ----------> HTTPD ----------> JFrog Container Registry
          HTTP            HTTP/AJP

Using AJP

The AJP protocol offers optimized low-level binary communication between the servlet container and Apache with additional support for smart-routing and load balancing.

The configuration is flexible and can be used either with mod_proxy_ajp, or with mod_jk.

The example below shows how to configure Apache using mod_proxy_ajp which is distributed by default, however you need to install and then enable as follows:

Enabling mod_proxy_ajp
sudo a2enmod proxy_ajp

Configuring Apache With mod_proxy_ajp Installed

The sample virtual host below refers to Apache as a reverse proxy to Tomcat, where Tomcat runs with the AJP connector on port 8019:

Page Contents

Configuring Apache with mod_ajp
<VirtualHost *:80>
    ServerAdmin your@email.address.com
    DocumentRoot "/srv/www/httpd/htdocs"
    ServerName artifactory.yourdomain.com
    ErrorLog "logs/artifactory-error_log"
    ProxyPreserveHost on
    ProxyPass /artifactory ajp://<yourdomain>:8019/artifactory
</VirtualHost> 

Reset Your Cookies

When changing the JFrog Container Registry context path in Apache make sure to reset your browser's host and session cookies.

Having a stale context path value cached by cookies can lead to inconsistent issue with the user interface such as Not authorized to instantiate class errors when switching between tabs.

Configuring Your Tomcat

If you are using a dedicated Tomcat rather than the one that is bundled with the JFrog Container Registry download zip file, you must configure the AJP connector located, by default, under $CATALINA_HOME/conf/server.xml:

Configuring a Dedicated Tomcat
<Connector port="8019"  protocol="AJP/1.3"
 maxThreads="500" minSpareThreads="20"
 enableLookups="false"
 backlog="100"/>

Please refer to Apache Tomcat Configuration Reference for more configuration options.

Configuring Apache With a Custom JFrog Container Registry Path

You can configure Apache using the same setup as above but here the goal is to have http://artifactory.yourdomain.com/repository/ as the root URL for JFrog Container Registry as follows:

Configuring Apache With Your Custom Artifactory Path
 <VirtualHost *:80>
    ServerAdmin your@email.address.com
    DocumentRoot "/srv/www/httpd/htdocs"
    ServerName artifactory.yourdomain.com
    ErrorLog "logs/artifactory-error_log"
    ProxyPreserveHost on
    ProxyPass /repository ajp://<yourdomain>:8019/artifactory
    ProxyPassReverse /repository http://artifactory.yourdomain.com/artifactory
    ProxyPassReverseCookiePath /artifactory /repository
</VirtualHost>

Using an HTTP Proxy

When running JFrog Container Registry with Tomcat, we recommend that you set up Apache to proxy JFrog Container Registry via HTTP.

You must configure redirects correctly using the PassReverse directive, and also set the base URL in JFrog Container Registry itself so that the UI links show up correctly.

The sample virtual host assumes that the Tomcat HTTP connector runs on port 8081.

Ensuring HTTP Redirect Works Correctly

For HTTP redirects to work, you must set a PassReverse directive on Apache, otherwise the underlying container base URL is passed in redirects

In the example below it is set to http://artifactory.yourdomain.com/artifactory/

Setting a PassReverse Directive on Apache
<VirtualHost *:80>
    ServerAdmin your@email.address.com
    DocumentRoot "/srv/www/httpd/htdocs"
    ServerName artifactory.yourdomain.com
    ErrorLog "logs/artifactory-error_log"
    ProxyPreserveHost on
    ProxyPass /artifactory http://<yourdomain>:8081/artifactory
    ProxyPassReverse /artifactory http://artifactory.yourdomain.com/artifactory
</VirtualHost>

Setting Up Apache HTTPS 

Setting up Apache HTTP server using AJP Protocol

JFrog Container Registry installations do not include the AJP connector in JFrog Container Registry’s Tomcat server.xml file (i.e. under $ARTIFACTORY_HOME/tomcat/conf/server.xml).
To use AJP connector, the <Connector port="8019" protocol="AJP/1.3" sendReasonPhrase="true"/> should be added manually to the server.xml file under <Service name="Catalina">.

Upgraded JFrog Container Registry environments will be unchanged provided the server.xml file is copied over.

Notice: AJP connector support will be removed in JFrog Container Registry's next major version (7.0).

You can set up Apache with SSL (HTTPS) as a front end to JFrog Container Registry using either the HTTP or AJP protocol.

Client ----------> HTTPD ----------> JFrog Container Registry
          HTTPS           HTTP/AJP

Using AJP

If you are not running JFrog Container Registry with Tomcat, then it is recommended to use AJP since it provides the servlet container with all the information about the correct base URL and requires no configuration in JFrog Container Registry.

Using an HTTP Proxy

Configuring Apache With mod_proxy_ajp Installed and Tomcat

The Apache and Tomcat sample configuration is as described in the section on Apache HTTP Server above under Using AJP.

Configuring a Custom URL Base in JFrog Container Registry

When using an HTTP proxy, the links produced by JFrog Container Registry, as well as certain redirects contain the wrong port and use the http instead of https.  

Therefore, you must configure a custom base URL as follows:

  1. On the Admin tab select Configuration | General Custom URL Base field.
  2. Set the Custom URL Base field to the value used to contact JFrog Container Registry on Apache
    For example: https://artifactory.yourdomain.com/artifactory

Please refer to General Configuration for more details about configuring the base URL.