问题描述
我刚刚开始使用 WildFly 8.2 进行 JAVA EE 开发.我的第一个问题是如何将默认端口 8080 更改为其他端口?
I just started JAVA EE development with WildFly 8.2. My first problem is how to change the default port 8080 to something else?
我发现了许多包含以下行的 xml 文件.
I found many xml files containing below line.
<socket-binding name="http" port="${jboss.http.port:8080}"/>
但我想我不必全部更改?!
but I guess I don't have to change all of them?!
推荐答案
在你的 standalone.xml 文件中,寻找这个元素:
In your standalone.xml file, look for this element:
<socket-binding-group name="standard-sockets" default-interface="public" port-offset="${jboss.socket.binding.port-offset:0}">
port-offset 属性允许您通过添加您指定的数字来修改 wildfly 使用的所有端口.
The port-offset attribute lets you modify all the ports wildfly uses, by adding the number you specify.
例如默认值为0
,表示http端口为8080
,remoting4447
等
For example, the default value is 0
, which means that http port will be 8080
, remoting 4447
, etc.
如果使用${jboss.socket.binding.port-offset:100}
,http端口为8180(8080+100)
,远程4547(4447+100)
等
If you use ${jboss.socket.binding.port-offset:100}
, http port will be 8180 (8080+100)
, remoting 4547 (4447+100)
, etc.
所以你需要改变偏移量,没有别的.
So you need to change the offset, nothing else.
您也可以通过在启动时使用系统属性来做到这一点,检查 http://www.mastertheboss.com/jboss-server/jboss-configuration/configuring-port-offset-on-jboss-as-wildfly
You can also do this by using a system property at startup, check http://www.mastertheboss.com/jboss-server/jboss-configuration/configuring-port-offset-on-jboss-as-wildfly
这篇关于如何更改 WildFly 中的默认端口 8080的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!