Search code examples
apachesubdomainbitbucketreverse-proxy

Set apache subdomain reverse proxy for bitbucket


I read several documentations "how to make it possible" like these

confluence.atlassian.com/kb/proxying-atlassian-server-applications-with-apache-http-server-mod_proxy_http-806032611.html

httpd.apache.org/docs/2.4/vhosts/examples.html

I not even try to use https for the moment. First I wanna a small success, access bitbucket via my subdomain...

Running:

Ubuntu 16.04.2 LTS

Bitbucket 5.0.0

Apache/2.4.18

/var/atlassian/application-data/bitbucket/shared/bitbucket.properties:

server.port=7990
server.secure=false
server.scheme=http
server.proxy-port=80
server.redirect-port=80
server.proxy-name=mysub.mydomain.mytld

/etc/apache2/sites-available/000-default.conf

<VirtualHost *:80>
        ServerName mysub.mydomain.mytld

        ProxyRequests Off
        ProxyVia Off


          ProxyPass "/" "http://mydomain.mytld:7990/"
          ProxyPassReverse "/" "http://mydomain.mytld:7990/"

</VirtualHost>

bitbucket base url (bitbucket settings administration)

 http://mysub.mydomain.mytld

restart commands

/etc/init.d/apache2 restart

within /opt/atlassian/bitbucket/5.0.0/bin/
./stop-bitbucket.sh
./start-bitbucket.sh
  • With the default bitbucket.properties bitbucket works, when I call http://mydomain:mytld:7990/
  • With my custom bitbucket.properties, when I call http://mysub.mydomain.mytld/ shows 500 internal error. In the apache logs:

    "No protocol handler was valid for the URL /. If you are using a DSO version of mod_proxy, make sure the proxy submodules are included in the configuration using LoadModule."


Solution

  • Finally the problem was wrong virtualHost configuration

    <VirtualHost subdomain.domain.tld:80> 
    
    ProxyPass "/" "http://localhost:7990/"
    
    ProxyPassReverse "/" "http://localhost:7990/"
    

    localhost... instead the public domain