java - 如何让 Jetty9 网络服务器监听 80 端口?
问题描述
如何jetty
配置为在端口 80 或其他任意但指定的端口上运行?
我没有jetty.port
在jetty.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:~$
解决方案
实际上是想问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:~$
结果还不错。
推荐阅读
- flutter - @override toString 方法在 Flutter Dart 类中的作用是什么?
- arrays - C中的电话号码验证功能
- parse-server - 解析服务器 result.attributes 与 get()
- javascript - 如何通过导航将数据传递到平面列表中?
- python - numpy快速傅里叶变换的数组正确排序
- java - 如何在 jpa 查询中加入具有多对多关系的两个实体
- css - CSS3 动画在 Firefox 中效果不佳(过渡不流畅)
- php - 在我的 WordPress 自定义插件“函数名称必须是字符串”中,我正在使用 $get_the_author_meta()
- java - 获取当前处理块的先前块值 - 弹簧批处理
- javascript - 如何解析无序列表
- 是兄弟姐妹