ARTIFACTORY: How to change Artifactory’s service port

Daniel Poterman
2023-03-15 07:44

Authors: Nir Shervi, Daniel Poterman

In this article we will demonstrate how you can change Artifactory’s service port in both versions 6.x and 7.x
Artifactory uses port 8081 by default. In version 6.x this port is also used to access the web UI.
In version 7.x the web UI is accessible via port 8082 and Artifactory’s service is still using port 8081.
In this example, we will change the port from 8081 to 8080.
 

How to change the port:

Instructions for version 7.x:

Navigate to $JFROG_HOME/artifactory/etc/ folder
Edit the “system.yaml” file and add the following values:artifactory:
    port: 8080
Make sure that the artifactory value is at the beginning of the new line and that the port value is indented properly. 
Restart Artifactory for the change to take effect.
More information can be found here.
 

Instructions for version 6.x:

Navigate to $ARTIFACTORY_HOME/tomcat/conf/ folder
Edit the “server.xml” file to modify the port number from 8081 to 8080
In order to change Artifactory’s port number to 8080 it would be required to change the line:<Connector port="8081" sendReasonPhrase="true" relaxedPathChars='[]' relaxedQueryChars='[]' maxThreads="200"/>To<Connector port="8080" sendReasonPhrase="true" relaxedPathChars='[]' relaxedQueryChars='[]' maxThreads="200"/>Restart Artifactory to apply the changes.

Verification: (Artifactory 7.x)

Execute the following command to verify the port changed after restarting the artifactory service:curl http://<ARTIFACTORY_VM_IP>:8080/artifactory/api/system/ping -v
*   Trying <ARTIFACTORY_VM_IP>:8080...
* Connected to <ARTIFACTORY_VM_IP> (<ARTIFACTORY_VM_IP>) port 8080 (#0)
* Server auth using Basic with user 'admin'
> GET /artifactory/api/system/ping HTTP/1.1
> Host: <ARTIFACTORY_VM_IP>:8080
> Authorization: Basic YWRtaW46UGFzc3dvcmQxIQ==
> User-Agent: curl/7.84.0
> Accept: */*
>
* Mark bundle as not supporting multiuse
< HTTP/1.1 200
< X-JFrog-Version: Artifactory/7.49.3 74903900
< X-Artifactory-Id: 8e6a0ae7cc192050:2207475a:18606ea432a:-8000
< X-Artifactory-Node-Id: nirsh-windows-upgrade
< Content-Type: text/plain
< Transfer-Encoding: chunked
< Date: Tue, 31 Jan 2023 08:49:08 GMT
<
* Connection #0 to host <ARTIFACTORY_VM_IP> left intact
OK%
The above output from the command using port 8080 instead of port 8081 and verified the port has been changed.

You may also check the connector is changed in the $JFROG_HOME/artifactory/app/artifactory/tomcat/conf/server.xml file as the following:<?xml version="1.0"?>
<!-- ~ Artifactory is a binaries repository manager. ~ Copyright (C) 2019 JFrog Ltd. ~ ~ Artifactory is free software: you can redistribute it and/or modify ~ it under the terms of the GNU Affero General Public License as published by ~ the Free Software Foundation, either version 3 of the License, or ~ (at your option) any later version. ~ ~ Artifactory is distributed in the hope that it will be useful, ~ but WITHOUT ANY WARRANTY; without even the implied warranty of ~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ~ GNU Affero General Public License for more details. ~ ~ You should have received a copy of the GNU Affero General Public License ~ along with Artifactory. If not, see <http://www.gnu.org/licenses/>. →
<Server shutdown="SHUTDOWN" port="8015"><Service name="Catalina">
<Connector port="8080" maxThreads="200" relaxedQueryChars="[]" relaxedPathChars="[]" sendReasonPhrase="false"/>
<Connector port="8091" maxThreads="5" acceptCount="5" address="localhost"/>
<!-- Must be at least the value of artifactory.access.client.max.connections →
<Connector port="8040" maxThreads="50" sendReasonPhrase="false" address="localhost"/>
<Engine name="Catalina" defaultHost="localhost"><Host name="localhost" startStopThreads="3" appBase="webapps" workDir="C:/jfrog/artifactory/var/work/artifactory/tomcat">
<Valve showServerInfo="false" showReport="false" className="org.apache.catalina.valves.ErrorReportValve"/>
</Host>
</Engine>
</Service>
</Server>