nginx redirect to bitbucket

This question is in reference to Atlassian Documentation: Securing Bitbucket Server behind nginx using SSL

We have JIRA & confluence behind nginx, and we access them like https://jira.domain.domhttps://confluence.domain.com

Your instruction gives way how to access like this: https://mycompany.com:7990/Bitbucket

Is it a big job to modify tomcat etc. so that the URL would "equal" https://bitbucket.domain.com

If there's already instructions for that, the links would be nice smile

 

2 answers

1 accepted

That is actually how I deploy these applications. Here is the nginx config:

 

server {

        listen 443;

        ssl on;

        ssl_certificate ssl/yourcertificate.crt;

        ssl_certificate_key ssl/yourcertiticatekey.key;

        server_name bitbucket.domain.com;


        add_header X-Frame-Options ALLOW;  

        location / {

              proxy_set_header X-Forwarded-Host $host;

              proxy_set_header X-Forwarded-Server $host;

              proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

              proxy_pass http://127.0.0.1:7990/;

              proxy_redirect off;

              proxy_connect_timeout 300;

        }

}

server {

        listen 80;

        server_name bitbucket.domain.com;

        rewrite ^ https://bitbucket.domain.com$request_uri? permanent;

}

 

In the server.xml file, update the connector for port 7990 with these options:

 

address="127.0.0.1"

                   secure="true"

                   scheme="https"

                   proxyName="bitbucket.domain.com"

                   proxyPort="443"

 

So the entire connector stanza looks like this:

 

<Connector port="7990" protocol="HTTP/1.1"

                   connectionTimeout="20000"

                   useBodyEncodingForURI="true"

                   redirectPort="8443"

                   compression="on"

                   compressableMimeType="text/html,text/xml,text/plain,text/css,application/json,application/javascript,application/x-ja

vascript"

                   address="127.0.0.1"

                   secure="true"

                   scheme="https"

                   proxyName="bitbucket.domain.com"

                   proxyPort="443"/>

I tried this config and can't seem to get it to stop appending the 7990 at the end. Do you have this issue ?

I do not have that issue. Check the Base URL in the Server Settings page of the admin. If you previously had a port there (:7990), you'll need to remove it from the Base URL field and click "Save" at the bottom of the page.

Suggest an answer

Log in or Sign up to answer
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Posted Jun 12, 2018 in Bitbucket

Do you use any Atlassian products for your personal projects?

After spinning my wheels trying to get organized enough to write a book for National Novel Writing Month (NaNoWriMo) I took my affinity for Atlassian products from my work life and decided to tr...

24,986 views 26 12
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you