how to set stash's port to 80?

I install stash on a server, and I want to set  its port to 80, so how can i do?

4 answers

You should look at the reverse proxy documentation for Stash.

Why would you want to start with this instead of simply changing the Tomcat port in server.xml?

I'd rather not run something, such as Stash, as a higher privileged user such as root, or an admin user.

1 vote
Steven Behnke Community Champion May 05, 2015

Well, Stash works just like the other Atlassian applications, so you can do what @Larry Shatzer suggested and reverse-proxy it to another webcontainer listening on port 80 OR you could change the server.xml for Stash's Tomcat to listen on port 80.

This isn't as much a Stash question as it is a web-container/application question, good question though. 

You can change server.xml. Also make sure to start the application under superuser otherwise sometimes you will not be able to bind to dedicated ports like 80 without root privilege.

 

e.g

<Connector port="80" 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-javascript" />

I can'f find the server.xml file, I installed stash by using xx.bin

The default path is /opt/atlassian/stash

There's no such file called `server.xml` in path `/opt/atlassian/stash/3.8.1`

There should be a directory called "conf". server.xml file is inside that directory.

yes, there's a folder called `conf`, but there's no server.xml also, files in this folder Catalina catalina.properties logging.properties tomcat-users.xml web.xml catalina.policy context.xml scripts.cfg tomcat-users.xsd

Sorry It is changed now. Pls refer below doc. The new path is /opt/atlassian/stash/3.8.1/shared https://confluence.atlassian.com/display/STASH/Changing+the+port+that+Stash+listens+on

I find the server.xml file, and do it following this link https://confluence.atlassian.com/display/STASH/Changing+the+port+that+Stash+listens+on, but it still doesn't work.

John Paz Atlassian Team May 06, 2015

So, you're able to change the port to 80? Could mark this as the answer? And just a heads up, the server.xml file did move recently so that you wouldn't have to carry over customizations when you upgraded. Old location: <Stash installation directory>/conf/server.xml New location: <Stash home directory>/shared/server.xml

I find the server.xml, but I give up to change the port, it seems not work, I set it following this link. https://confluence.atlassian.com/display/STASH/Changing+the+port+that+Stash+listens+on

Then its something wrong with your set up and its up to you to trouble shoot. Above link explains how to do it correctly.

0 votes
Daniel Wester Community Champion May 08, 2015

You can't change the port to be port 80 if you're running linux. In order for a process to be run on a port <100 it needs to be run as root. I would not run Stash as root because of the git hooks.

To "change" the port - add nginx or apache in front of it and have them reverese proxy to port 80. You can do it with iptables as well but that might get messy real quick.

Suggest an answer

Log in or Sign up to answer
Community showcase
Published Nov 06, 2018 in Bitbucket

Upgrade Best Practices

Hello! My name is Mark Askew and I am a Premier Support Engineer for products Bitbucket Server/Data Center, Fisheye & Crucible. Today, I want to bring the discussion that Jennifer, Matt, and ...

433 views 6 9
Read article

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