How to change default ports in wildfly

Every server runs at some pre-defined default ports. But you can also change the default setting so that the server listens at the configured port number.

Default ports of Wildfly
Following are the default ports of wildfly for http and https protocols.

  • http: 8080
  • https: 8443

How to change ports in wildfly
There are two methods to change default ports in wildfly
1. From configuration XML
Navigate to the wildfly install location or where it was extracted and look for standalone.xml inside <wildfly location>/standalone folder. This is the configuration file for wildfly.
Edit the file and search forĀ socket-binding-group tag.
It would normally be located at the end of the file and will look like something as below.
wildfly port configurationwhere highlighted portions represent http and https ports.
If you want to start wildfly listening at http port 9090, then change the property corresponding to http as

<socket-binding name=”http” port=”${jboss.http.port:9090}”/>

and restart the server. It will be now listening on port number 9090.

2. From command line argument
Supply required ports as arguments when starting wildfly from batch file in windows or .sh file in linux or mac as below.

standalone.bat -Djboss.http.port=9090

and

standalone.sh -Djboss.http.port=9090

Note that the property jboss.http.port is the same as that defined in standalone.xml, we are just overriding its value from the command line.
Hope you liked this article. Hit the clap below to like.

Leave a Reply