httpsarchiva

How to setup Apache Archiva to use HTTPS instead of HTTP


In default configuration, Apache Archiva 2.2 uses HTTP, and official documentation tells nothing how to change it to HTTPS.

I think that this can be done by modifying conf/jetty.xml file, but when I try to do this, as described in Jetty documentation, it only gives me errors like:

java.lang.NoSuchMethodException: class org.eclipse.jetty.util.ssl.SslContextFactory.setTrustStorePath(class java.lang.String)

Is it possible to do this?


Solution

  • I used Apache as a HTTPS proxy, configuring new virtual host:

    Listen 8081
    
    <VirtualHost *:8081>
            ServerName archiva.example.com
    
            SSLEngine On
            SSLCertificateFile    /path/to/apache_certs/cert.pem
            SSLCertificateKeyFile /path/to/apache_certs/cert.key
    
            ProxyRequests     Off
            ProxyPass         /  http://localhost:8080/
            ProxyPassReverse  /  http://localhost:8080/
            <Proxy http://localhost:8080/*>
                    Order allow,deny
                    Allow from all
            </Proxy>
            ProxyPreserveHost on
    </VirtualHost>
    

    Don't forget to enable two apache mods that are necessary to run this:

    sudo a2enmod proxy proxy_http