From 6ea3d71a26af61943a17ac1c5f91ffbbe8d9d7b6 Mon Sep 17 00:00:00 2001 From: Shaun Henderson Date: Fri, 22 Nov 2024 19:50:18 +1300 Subject: [PATCH] Updated with clearer instructions for configuring Apache --- Reverse-proxy-with-Apache.md | 28 ++++++++++++++++++++-------- 1 file changed, 20 insertions(+), 8 deletions(-) diff --git a/Reverse-proxy-with-Apache.md b/Reverse-proxy-with-Apache.md index fa08f05..8df168e 100644 --- a/Reverse-proxy-with-Apache.md +++ b/Reverse-proxy-with-Apache.md @@ -1,16 +1,28 @@ ### 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. -2. Add the following to your site configuration (assuming your GitBucket prefix is "gitbucket") [where i can find site configuration?]: - - AllowEncodedSlashes NoDecode # ... or "On" for Apache-2.2 - ProxyPreserveHost On - ProxyPass /gitbucket http://localhost:8080/gitbucket - ProxyPassReverse /gitbucket http://localhost:8080/gitbucket -3. Go to System Settings (http://localhost/gitbucket/admin/system) and modify the Base URL to https://www.example.com/gitbucket +1. Install and enable `mod_proxy` and `mod_proxy_http` modules: +``` + sudo a2enmod proxy + sudo a2enmod proxy_http +``` +2. Add the following to your site configuration (`sudo nano /etc/apache2/sites-enabled/000-default.conf`) AFTER the default VirtualHost: +``` + + ... + + AllowEncodedSlashes NoDecode # ... or "On" for Apache-2.2 + ProxyPreserveHost On + ProxyPass /gitbucket http://localhost:8080/gitbucket + ProxyPassReverse /gitbucket http://localhost:8080/gitbucket +``` +You can also use %{SERVER_NAME} in place of localhost. +3. Restart Apache: +`sudo apache2 restart` +4. 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`