Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Next challenges

Recent achievements

  • Global
  • Personal

Recognition

  • Give kudos
  • Received
  • Given

Leaderboard

  • Global

Trophy case

Kudos (beta program)

Kudos logo

You've been invited into the Kudos (beta program) private group. Chat with others in the program, or give feedback to Atlassian.

View group

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Bitbucket server is redirecting to localhost:7990 behind nginx reverse proxy

  • I have Bitbucket server 7.1.1
  • Running on CentOS 7
  • Running behind an nginx reverse proxy
  • Running on port 7990
  • With the baseUrl configured within the settings admin panel

I can access bitbucket through my the web interface by going to the reverse proxied address git.domain.com. When I do, it asks for my login, and then upon successful login, I am redirected to http://localhost:7990.

Then (since I am an admin) I see a warning in the upper right corner that there is a "Base URL mismatch", but when I go to set the base URL, it is already set to git.domain.com.

Finally, when I go to create a new repository and get its URL to clone it for the first time, I see http://localhost:7990/<....>/project.git in the URL instead of the base URL http://git.domain.com/<...>/project.git. 

I would guess this all stems from the same issue, but even through searching all of the answers online, I cannot figure out a solution to this problem!

How do I stop it from referencing http://localhost:7990 even when the base URL is configured?

Also, I am not using SSL and do not plan to at this time.

For reference, this is what my reverse proxy nginx script looks like:

server {
    server_name git.domain.com;
    listen 80;

    location / {
        proxy_pass http://localhost:7990/;
        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_set_header X-Real-IP $remote_addr;
   
        client_max_body_size 10M;
        proxy_connect_timeout 180s;
        proxy_send_timeout 180s;
        proxy_read_timeout 180s;
    }
}

1 answer

1 accepted

1 vote
Answer accepted

Hi Michael,

You'll need to add 

server.proxy-port=80
server.proxy-name=git.company.com

to bitbucket.properties and restart Bitbucket Server.

Cheers,

Christian

Premier Support Engineer

Atlassian

Thank goodness! That was all it took and now it works.

For anyone else looking, my bitbucket.properties file was not in the same location as my bitbucket installation on CentOS 7. The installation is in the /opt/atlassian/bitbucket directory, whereas this properties file is in /var/atlassian/application-data/bitbucket (in the shared directory).

These are instructions I have been unable find online in all my google searches for "Install bitbucket behind nginx reverse proxy," with various combinations of including my operating system and bitbucket server version.

Can you point me to where I should have found these installation steps to correctly configure this installation behind the reverse proxy?

Hi Michael,

The title of this article is perhaps a bit misleading, because it applies regardless of whether you use SSL or not:

https://confluence.atlassian.com/bitbucketserver/securing-bitbucket-server-behind-nginx-using-ssl-776640112.html

Cheers,

Christian

Premier Support Engineer

Atlassian

Like Michael_Plautz likes this

Thank you. I now recall even looking at this article, but I was unable to make the leap between using port 443/TCP for SSL and 80/TCP for standard HTTP in the properties file. 

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
SERVER
VERSION
7.1.1
TAGS
Community showcase
Published in Bitbucket

Powering DevOps with Bitbucket Server & Data Center

Hi everyone, The Cloud team recently announced 12 new DevOps features that help developers ship better code, faster   ! While we’re all excited about the new improvements to Bitbucket ...

1,922 views 0 7
Read article

Community Events

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

Find an event

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

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you