首页 > 解决方案 > 如何让 Jetty9 网络服务器监听 80 端口?

问题描述

如何jetty配置为端口 80 或其他任意但指定的端口上运行?

我没有jetty.portjetty.xml文件中看到:

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:~$ 

目前在8080wildfly运行

标签: javaxmlserverwebserverport

解决方案


实际上是想问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:~$ 

结果还不错。


推荐阅读