Skip to content

Instantly share code, notes, and snippets.

@hgomez
Last active August 29, 2015 14:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hgomez/1f0c7d9abaa87722b0c2 to your computer and use it in GitHub Desktop.
Save hgomez/1f0c7d9abaa87722b0c2 to your computer and use it in GitHub Desktop.
Using Apache HTTPd with mod_jk and mod_rewrite in front of artifactory 3.4.x for docker hosting

JFrog documentation (http://www.jfrog.com/confluence/display/RTF/Docker+Repositories) show how to use nginx as front end for Artifactory/Docker hosting :

If you're using Apache HTTPd and mod_jk, you could do it too. Just enroll mod_rewrite.

Simple case, Tomcat with artifactory.war in webapp directory, aka http://artprod.company.com:8080/artifactory/ Here is a front-end, in SSL, dedicated to serve docker-local contents (and translate URIs)

<VirtualHost *:443>

  ServerName  artprod.company.com
  ServerAdmin admin@company.com

  SSLEngine on
  SSLCertificateFile "/etc/apache2/ssl.crt/artprod.company.com.crt"
  SSLCertificateKeyFile "/etc/apache2/ssl.key/artprod.company.com.key"

  ErrorLog /var/log/apache2/artprod.company.com_error_log
  CustomLog /var/log/apache2/artprod.company.com_access_log combined

  # don't loose time with IP address lookups
  HostnameLookups Off

  # needed for named virtual hosts
  UseCanonicalName Off

  # configures the footer on server-generated documents
  ServerSignature On

  # JK relay
  JkMount /artifactory/* artifactory;fail_on_status=503;use_server_errors=503

  RewriteEngine On

  RewriteRule "^/artifactory/(.*)$" "/artifactory/api/docker/docker-local/$1" [NC,L,PT]

</VirtualHost>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment