Bitbucket Server 5.0 introduces some changes to how connector configuration customisation is performed. In Bitbucket Server 4.x and earlier Bitbucket Server startup involved starting Apache Tomcat and deploying the web application into Tomcat. Customising connector configuration (for example to secure connections with SSL) involved updating the Tomcat server.xml file.
In Bitbucket Server 5.0 and later, an embedded container (still Apache Tomcat) is started by the application. This allows you to make customizations to connector configuration directly in the bitbucket.properties file (the same file that hosts the vast majority of other settings).
Upgrading from any version earlier than Bitbucket Server 4.14 or earlier to Bitbucket Server 5.x or later requires that you manually migrate any changes to the server.xml file to the bitbucket.properties file.
This document explains in what cases this may be necessary, describes how to perform this migration, and provides some migration examples for common use cases.
How do I know if there were customizations to my server.xml file?
The server.xml file was where you would make customizations to do a number of things, but most users used it to:
Secure Bitbucket Server using SSL.
Run Bitbucket Server behind a reverse proxy.
Changed the port Bitbucket Server runs on.
Set up a custom keystore.
How to migrate your customizations to bitbucket.properties
To migrate customizations made in the server.xml file to the bitbucket.propertiesfile
Locate your bitbucket.properties file in the <Bitbucket home directory>/shared directory.
Look up the customization equivalent in the bitbucket.properties file by referring to one of the migration examples and/or by using the migration table below.
Add the equivalent values to the bitbucket.properties file. Save and close the file.
Remove or rename the server.xml file (don't delete this file until you confirm the customizations were successfully migrated to your upgraded instance).
Below are some examples that demonstrate some common use cases for customizing the server.xml file, and how you would migrate those values to the bitbucket.properties file.
For these examples, if there are less properties in the bitbucket.properties syntax then in the initial server.xml syntax, that indicates the default value would be acceptable and you don't need to add that property to achieve the same result.
When adding values with file paths in them, for instance server.context-path, backslashes are escaped by default. Be sure to include two backslashes in any values with file paths in them.
Additional connectors
Bitbucket Server is preconfigured with a single connector and, as previously described, the default configuration for that connector can be configured using properties with a server.prefix. For example to change the port from the default 7990 to 7991:
server.port=7991
Bitbucket Server also supports up to five additional connectors and these are configured using properties with prefix server.additional-connector.#, where # is a number between 1 and 5 inclusive. For example, if in addition to the default connector that is configured to listen on port 7990, you wanted to add an SSL secured connector listening on port 8443, you would add these lines to the bitbucket.properties file:
Running Bitbucket behind a reverse proxy secured with SSL
If Bitbucket Server is configured to run behind a reverse proxy that is secured with SSL, the existing server.xml file might contain the following connector configuration:
For these examples, if there are less properties in the bitbucket.properties syntax then in the initial server.xml syntax, that indicates the default value would be acceptable and you don't need to add that property to achieve the same result. For example, the port for the default connector is 7990, the default protocol is HTTP/1.1, and so on.
Bitbucket Server secured with SSL-terminating connector
If Bitbucket Server is secured with SSL, where the SSL connection is terminated at the application rather than a proxy, the existing server.xml file might contain the following connector configuration:
Both ssl.key-store-password and ssl.key-password require explicit configuration. Even if you did not configure both values in the server.xml file, values for both entries need to be explicitly set in bitbucket.properties to secure Bitbucket with SSL.
Bitbucket Server secured with SSL and additional connector to redirect HTTP requests
For some with an SSL-terminating connector configured, you might also have an additional connector that redirects HTTP requests to the HTTPS connector. This would have required you to also specify an additional attribute in the <Bitbucket installation directory>/atlassian-bitbucket/WEB-INF/web.xml file.
Here's what that configuration might have looked like prior to Bitbucket Server 5.0:
For these examples, if there are less properties in the bitbucket.properties syntax then in the initial server.xml syntax, that indicates the default value would be acceptable and you don't need to add that property to achieve the same result.