【问题标题】:How to make Jetty9 webserver listen on port 80?如何让 Jetty9 网络服务器监听 80 端口?
【发布时间】:2021-10-07 12:25:37
【问题描述】:

jetty 如何在端口 80 或其他任意但指定的端口上配置为 run

我在jetty.xml 文件中没有看到jetty.port

nicholas@mordor:~$ 
nicholas@mordor:~$ cat /etc/jetty9/jetty.xml | grep port
      <Set name="securePort"><Property name="jetty.httpConfig.securePort" deprecated="jetty.secure.port" default="8443" /></Set>
nicholas@mordor:~$ 
nicholas@mordor:~$ uname -a
Linux mordor 5.11.0-25-generic #27-Ubuntu SMP Fri Jul 9 23:06:29 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
nicholas@mordor:~$ 

因为wildflyrunning 在8080 上moment

【问题讨论】:

    标签: java xml server webserver port


    【解决方案1】:

    其实是想在askubuntu上提问:

    nicholas@mordor:~$ 
    nicholas@mordor:~$ cat /etc/jetty9/start.ini
    #------------------------------------------------------------------------------
    #
    # Jetty Startup Configuration
    #
    # This file contains the default settings for Jetty and configures a basic
    # Servlet container with JSP and WebSocket enabled. Customized settings can
    # be added to .ini files in the /etc/jetty9/start.d directory to avoid
    # conflicts when updating the package.
    #
    #------------------------------------------------------------------------------
    
    --module=deploy,http,jsp,jstl,websocket,ext,resources
    
    ##
    ## HTTP Connector Configuration
    ##
    
    # What host to listen on (leave commented to listen on all interfaces)
    #jetty.host=myhost.com
    
    # HTTP port to listen on
    # Enable authbind in /etc/default/jetty9 to use a port lower than 1024
    jetty.port=8080
    
    # HTTP idle timeout in milliseconds
    http.timeout=30000
    
    
    ##
    ## Server Threading Configuration
    ##
    
    # minimum number of threads
    threads.min=10
    
    # maximum number of threads
    threads.max=200
    
    # thread idle timeout in milliseconds
    threads.timeout=60000
    nicholas@mordor:~$ 
    nicholas@mordor:~$ sudo nano /etc/jetty9/start.ini 
    nicholas@mordor:~$ 
    nicholas@mordor:~$ sudo /etc/init.d/jetty9 stop
    Stopping jetty9 (via systemctl): jetty9.service.
    nicholas@mordor:~$ 
    nicholas@mordor:~$ sudo /etc/init.d/jetty9 start
    Starting jetty9 (via systemctl): jetty9.service.
    nicholas@mordor:~$ 
    nicholas@mordor:~$ lynx localhost:8081 --dump
       [1][jetty_banner.gif]
    
                              Welcome to Jetty 9 on Debian
    
       Jetty is a 100% Java HTTP Server and Servlet Container. This means that
       you do not need to configure and run a seperate web server (like
       Apache) in order to use java, servlets and JSPs to generate dynamic
       content. Jetty is a fully featured web server for static and dynamic
       content. Unlike separate server/container solutions, this means that
       your web server and web application run in the same process, without
       interconnection overheads and complications. Furthermore, as a pure
       java component, Jetty can be simply included in your application for
       demonstration, distribution or deployment. Jetty is available on all
       Java supported platforms.
    
    References
    
       1. http://jetty.mortbay.org/
    nicholas@mordor:~$ 
    

    结果还不错。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2012-08-11
      • 1970-01-01
      • 2016-10-07
      • 2012-05-17
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-06-29
      相关资源
      最近更新 更多