如何让 Jetty9 网络服务器监听 80 端口? [英] How to make Jetty9 webserver listen on port 80?

查看:41
本文介绍了如何让 Jetty9 网络服务器监听 80 端口?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

How is jetty configured to run on port 80, or some other arbitrary but specified port?

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

I'm not seeing jetty.port in the jetty.xml file:

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

As wildfly 在 8080 上 时刻.

As wildfly is running on 8080 at the moment.

推荐答案

实际上是想在 askubuntu 上提问:

actually meant to ask on 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:~$ 

结果还不错.

这篇关于如何让 Jetty9 网络服务器监听 80 端口?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆