Jetty Port (Admin Panel) Port Configuration in SmartFoxServer2X


Jetty is webserver, SmartfoxServer2x uses this to run the AdminTool. By default jetty runs at 8080 port if we want to configure the jetty port then follows these steps.

SmartFoxServer2X uses Jetty 8 and 9 in various versions means upto SmartfoxServer2X 2.5 it uses 'Jetty 8' where as from the SmartFoxServer 2.5 it uses 'Jetty 9' instead of Jetty 8

Configuration of jetty port will vary from Jetty 8 and Jetty 9

Why and When I Need To Configure/Change The Jetty Port

> While reading this someone may get the thought that "why need to change the default port and When I need to change this"

> The default port of jetty is 8080, if any program of our system using the same port then our SmartfoxServer2X admin panel (runs on jetty server) will not open.

> In clear for example I am using tomcat for other program in my system Tomcat will also use 8080 as a default port in this case 8080 can't allocate for jetty, like in these situations we need get the situtaions to alter the default jetty port.

> Jetty 8 Port Configuration

  • Open jetty.xml file from config folder of SmartfoxServer2X.
    (SFS2X -> config -> jetty -> jetty.xml)
  • Jetty uses two ports one for http connections and another for https connections.
  • Search for jetty.port string, and modify the default port with "ourportno"
  • Search for ConfidentialPort string (for https mode) by default it is 8443 and replace it with required port.
  • Open the port in router if need
  • Check This Example. Here I am changing the http port to 2017, https port to 1917
01 < Call name = "addConnector" >
02      < Arg >
03           < New class = "org.mortbay.jetty.nio.SelectChannelConnector" >
04               < Set name = "host" >< SystemProperty name = "jetty.host" />
05               < Set name = "port" >< SystemProperty name = "jetty.port" default = "2017" />
06               < Set name = "maxIdleTime" >30000</ Set >
07               < Set name = "Acceptors" >2</ Set >
08               < Set name = "statsOn" >false</ Set >
09               < Set name = "confidentialPort" >1917</ Set >
10               < Set name = "lowResourcesConnections" >5000</ Set >
11               < Set name = "lowResourcesMaxIdleTime" >5000</ Set >
12           </ New >
13        </ Arg >
14 </ Call >

> Jetty 9 Port Configuration

  • Open http.ini and https.ini files in SmartfoxServer2X.
  • In SmartfoxServer2x we can found those files in this location
    SFS2X -> lib -> jetty ->start.d ->http.ini
    SFS2X -> lib -> jetty ->start.d ->https.ini
  • Modify the default http(jetty) and https ports with required ports if needed
    jetty.port=our new port in http.ini (like jetty.port=8181)
    https.port=our new https port in https.ini (like https.port=8383)
  • Check This Example. Here I am changing the http port to 2017, https port to 1917
http.ini file
1 # Initialize module http
2 #--module=http
3 ## HTTP Connector Configuration
4 jetty.port=2017
5 http.timeout=30000
https.ini file
1 # Initialize module https
2 #--module=https
3 ## HTTPS Configuration
4 # HTTP port to listen on
5 https.port=1917
6 # HTTPS idle timeout in milliseconds
7 https.timeout=30000
Copyright © 2018-2020 TutorialToUs. All rights reserved.