12
Reverse proxy with Apache
Shaun Henderson edited this page 2024-11-22 19:51:34 +13:00

Prerequisites

  1. Apache is installed and running on your server.
  2. GitBucket is running on some port. The default is 8080.
  3. You are using the prefix of /gitbucket.

Apache HTTP server set up

  1. Install and enable mod_proxy and mod_proxy_http modules:
    sudo a2enmod proxy
    sudo a2enmod proxy_http
  1. Add the following to your site configuration (sudo nano /etc/apache2/sites-enabled/000-default.conf) AFTER the default VirtualHost:
    <VirtualHost *:80>
        ...
    </VirtualHost>
    AllowEncodedSlashes NoDecode # ... or "On" for Apache-2.2
    ProxyPreserveHost On
    ProxyPass /gitbucket http://localhost:8080/gitbucket
    ProxyPassReverse /gitbucket http://localhost:8080/gitbucket
  1. Restart Apache: sudo apache2 restart

  2. Go to System Settings (http://localhost:8080/gitbucket/admin/system) and modify the Base URL to https://www.example.com/gitbucket

Note! Apache and GitBucket context paths must be equal: java -jar gitbucket.war --port=8080 --prefix=/gitbucket (Note the leading / in the prefix)