By default, applications in wildfly are deployed to localhost:8080/app , how to deploy an application on a separate port without the name of the application itself, for example, to open it at localhost:8282 ?

    1 answer 1

    All Wildfly configuration is in the domain * .xml or standalone * .xml files. Example for standalone.xml and Wildfly10:

    open %JBOSS_HOME%/standalone/configuration/standalone.xml In the socket-binding-group tag, add in addition to http and https add http2 and https2

     <!--Стандартные биндинги--> <socket-binding name="http" port="${jboss.http.port:8080}"/> <socket-binding name="https" port="${jboss.https.port:8443}"/> <!--Добавленные биндинги--> <socket-binding name="http2" port="${jboss.http.port:8089}"/> <socket-binding name="https2" port="${jboss.https.port:8449}"/> 

    Next, look for urn:jboss:domain:undertow:3.0 and add a new server:

     <!--Сервер по умолчанию--> <server name="default-server"> <http-listener name="default" socket-binding="http" redirect-socket="https"/> <host name="default-host" alias="localhost"> <filter-ref name="server-header"/> <filter-ref name="x-powered-by-header"/> </host> </server> <!--Сервер, который мы добавили--> <server name="non-default-server"> <http-listener name="oteher" socket-binding="http2" redirect-socket="https2"/> <host name="default-host" alias="localhost"> <filter-ref name="server-header"/> <filter-ref name="x-powered-by-header"/> </host> </server> 

    Notice, from both servers deleted:

     <location name="/" handler="welcome-content"/> 

    It is necessary for the bind of our applications to "/"

    Everything. Configuration can be saved Wildfly server restart .

    Further, in the application itself in the WEB-INF you need to create a jboss-web.xml with the following contents:

     <?xml version="1.0" encoding="UTF-8"?> <jboss-web> <context-root>/</context-root> <server-instance>non-default-server</server-instance> </jboss-web> 

    If server-instance not specified, then applications will be bundled to the main server

    That is, in this situation, your server will listen to 2 ports at once. If you just need to change the port and context-root, then the task is reduced to editing socket-binding and adding jboss-web.xml