Java – Configuring a Jetty web application on a different port

javajetty

I'm brand new to Jetty.

I'd like to ask if its possible to have Jetty listening on port 8080, however where specified, serve a specific web application under say /var/jetty/webapps/<appname> (default on CentOS) served on say port 10000 instead of http://localhost:8080/<appname> i.e. http://localhost:10000/ = http://localhost:8080/<appname> ?

If so, what configuration changes would be required to make this work without an additional proxy server? I've googled away, but haven't found a solution (perhaps I've missed something obvious?).

Best Answer

You can change the port on a linux deployment using the environment variable JETTY_PORT.

eg:

export JETTY_PORT=20000

Then launch the application.