Running Behind HTTP Server
Setting up Apache HTTPd as a Front-end to Artifactory
You may want to use Artifactory behind Apache HTTPd. This can be achieved via two alternative protocols HTTP or 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.
It can be used in Apache with mod_proxy_ajp, or with mod_jk - for greater configuration flexibility.
The examples below use mod_ajp which is distributed with Apache by default.
Configuring Apache with mod_ajp Installed
The sample virtual host refers to Apache as a reverse proxy to Tomcat, where Tomcat runs with the AJP connector on port 8009:
Configuring Apache with Changing the Artifactory Path
This configuration uses the same setup as above but here the goal is to have http://artifactory.yourdomain.com/repository/ as root URL for Artifactory:
Tomcat Configuration
If you are not using the bundled Tomcat with the Artifactory zip, but using a dedicated Tomcat, you must configure the AJP connector, located by default under $CATALINA_HOME/conf/server.xml:
See here for more configuration options.
Using HTTP Proxy
Having Apache Proxy Artifactory via HTTP is the recommended setup when running Artifactory with Jetty.
It is required to configure correct redirects using the pass-reverse directive and to set the base URL in Artifactory itself so that UI links show up correctly.
Configuring Apache with mod_proxy_http Installed
The sample virtual host assumes Tomcat or Jetty HTTP connector runs on port 8081.
NOTE! that for HTTP redirects to work, you must set a pass-reverse directive on Apache, or the underlying container base URL is passed in redirects (in this example to http://artifactory.yourdomain.com/artifactory/).
Proxying Apache HTTPs to Artifactory running HTTP
You can run Artifactory behind Apache with SSL (HTTPs). This can also be achieved using HTTP or AJP:
Using AJP
If you are not using Jetty (see above: AJP and Jetty), then AJP is recommended since it informs the servlet container everything about the correct base URL and requires no configuration in Artifactory.
Configuring Apache with mod_proxy_ajp Installed and Tomcat
The Apache and Tomcat sample configurations are identical to the one listed in "Using AJP" on this page for non-HTTPs Apache.
Using HTTP Proxy
Configuring Apache with mod_proxy_http Installed and Tomcat
The Apache and Tomcat sample configurations are identical to that detailed in "Using HTTP Proxy" on this page for non-HTTPs Apache.
Configuring a Custom URL Base in Artifactory
When not using AJP, the links produced by Artifactory, as well as certain redirects not only contain the wrong port but use the http scheme instead of https.
To configure a custom base URL:
- Go to the Admin tab and then
Configuration -> General -> Custom URL Base field. - Set the base URL to the value used to contact Artifactory on Apache
For example: https://artifactory.yourdomain.com/artifactory
See the General Configuration section for more details about configuring the base URL.