Change Jetty default port

前端 未结 10 1143
野性不改
野性不改 2020-12-29 04:15

Jetty default port is 8080, but I want to change to default port to some other port (9999).

I read a few tutorials and they said almost all of configuration informa

相关标签:
10条回答
  • 2020-12-29 05:10

    On jetty 9.2.3.v20140905 it`s need to write in /etc/default/jetty

    # JETTY_ARGS
    #   The default arguments to pass to jetty.
    #   For example
    JETTY_ARGS="jetty.port=8080 jetty.spdy.port=8443 jetty.secure.port=443"
    

    but this change only http port. To change https port in jetty 9.2 create ini file $JETTY_HOME/start.d/https.ini

    # Initialize module https
    #
    --module=https
    ## HTTPS Configuration
    # HTTP port to listen on
    https.port=8443
    # HTTPS idle timeout in milliseconds
    https.timeout=30000
    # HTTPS Socket.soLingerTime in seconds. (-1 to disable)
    # https.soLingerTime=-1
    

    jetty 9.3 in /etc/default/jetty

    # JETTY_ARGS
    # The default arguments to pass to jetty.
    # For example
    JETTY_ARGS="jetty.http.port=8080 jetty.ssl.port=443"
    

    or command line parameters -Djetty.http.port=8080 -Djetty.ssl.port=443

    0 讨论(0)
  • 2020-12-29 05:11

    For SSL port you can pass the param:

    -Dssl.port=8445
    

    It worked for me.

    0 讨论(0)
  • 2020-12-29 05:15

    does it work if you set the port when you start it from the command line like this:

    java -jar start.jar -Djetty.port=9999
    
    0 讨论(0)
  • 2020-12-29 05:16

    I did this in Jetty 9.x version. You need to go to $JETTY_HOME/start.ini file and edit this setting jetty.port.

    Lets say that you want to run jetty at 9090 port: Please change jetty.port setting in $JETTY_HOME/start.ini from

    jetty.port=8080
    

    to

     jetty.port=9090
    

    Then start jetty using java -jar start.jar option. Then jetty will be running at 9090 port than default 8080 port. Then do curl -i -XGET "http://localhost:9090". That should give you 200 http status.

    Thats it.

    0 讨论(0)
提交回复
热议问题