Install Gitbucket with Own Hostname

Preparation

Download the gitbucket.war file, for example to /home/gitbucket/app/

Start gitbucket gitbucket.example.com

cd /home/gitbucket/app/
nohup java -jar gitbucket.war --port=8080 --hostname=gitbucket.example.com --gitbucket.home=/home/gitbucket/repos > /home/gitbucket/log>&1 &

Enable apache2 Proxyp Reserve Host

Edit a gitbucket.conf in /etc/apache2/sites-available

vim /etc/apache2/sites-available/gitbucket.conf

Example:

<VirtualHost *:80>
        ServerName gitbucket.example.com

        # proxy
        proxypreservehost on
        proxypass       /       http://localhost:8080/
        proxypassreverse /      http://localhost:8080/
        proxypassreversecookiepath      /       /


        ErrorLog ${APACHE_LOG_DIR}/error.log
        CustomLog ${APACHE_LOG_DIR}/access.log combined

</VirtualHost>

Reload Apache2 service

systemctl reload apache2