how to change the port to 80 correctly?

Bin Hua May 6, 2015

I change the port following this link https://confluence.atlassian.com/display/STASH/Changing+the+port+that+Stash+listens+on, but both the two link  http://stash_visit_url.com and http://stash_visit_url.com:7990 can't be visited.

I changed the server.xml like following

<Server port="80" shutdown="SHUTDOWN">

    <!-- Security listener. Documentation at /docs/config/listeners.html

    <Listener className="org.apache.catalina.security.SecurityListener" />

    -->

    <!--APR library loader. Documentation at /docs/apr.html -->

    <Listener className="org.apache.catalina.core.AprLifecycleListener" SSLEngine="on" />

    <!-- Prevent memory leaks due to use of particular java/javax APIs-->

    <Listener className="org.apache.catalina.core.JreMemoryLeakPreventionListener" />

    <Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener" />

    <!--Listener className="org.apache.catalina.core.ThreadLocalLeakPreventionListener" /-->

    <!-- Global JNDI resources

         Documentation at /docs/jndi-resources-howto.html

    -->

    <GlobalNamingResources>

        <!-- Editable user database that can also be used by

             UserDatabaseRealm to authenticate users

        -->

        <Resource name="UserDatabase" auth="Container"

                  type="org.apache.catalina.UserDatabase"

                  description="User database that can be updated and saved"

                  factory="org.apache.catalina.users.MemoryUserDatabaseFactory"

                  pathname="conf/tomcat-users.xml" />

    </GlobalNamingResources>




    <!-- A "Service" is a collection of one or more "Connectors" that share

         a single "Container" Note:  A "Service" is not itself a "Container",

         so you may not define subcomponents such as "Valves" at this level.

         Documentation at /docs/config/service.html

     -->

    <Service name="Catalina">




        <!--The connectors can use a shared executor, you can define one or more named thread pools-->

        <!--

        <Executor name="tomcatThreadPool" namePrefix="catalina-exec-"

            maxThreads="150" minSpareThreads="4"/>

        -->







        <!-- A "Connector" represents an endpoint by which requests are received

             and responses are returned. Documentation at :

             Java HTTP Connector: /docs/config/http.html (blocking & non-blocking)

             Java AJP  Connector: /docs/config/ajp.html

             APR (HTTP/AJP) Connector: /docs/apr.html

             Define a non-SSL HTTP/1.1 Connector on port 7990




             If you change this port, you have to update scripts.cfg as well

             to have the same port configuration.

        -->

        <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" />

2 answers

0 votes
rrudnicki
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
May 7, 2015

Hi Bin, 

Try to change the Connector port to 7990, restart Stash and then try to access this: <stash-url>:7990

Also make sure you don't have any firewall blocking the port number that you are trying to reach.

 

Hope this helps. 

 

Regards, 

Renato Rudnicki

Bin Hua May 7, 2015

thanks, but I want to access with port 80, not 7990

0 votes
steve
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
May 6, 2015

Two things might be at play here, and I'd highly suggest checking the logs for specific errors, but:

Firstly on the first line, your config appears slightly off.

&lt;Server port="80" ...&gt;

Should instead, be left as is, being:

&lt;Server port="8006" ...&gt;

The documentation says "Free port", but unless 8006 is being used by another service, it can stay as is. It isn't used by the end-users.

Secondly, for the Connector port, which is in the <Connector...> part of the config file, this is where the user-facing port is defined. Port 80 on most machines are protected from being used by non-root users, so if you're running as a non-root user you might want to look at doing a port forward instead. I'd try switching Server port back and seeing if the service runs.

See the section "Using a reverse proxy for Stash" on https://confluence.atlassian.com/display/STASH/Proxying+and+securing+Stash for more information on how to do that, without running Stash as root.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events