Ubuntu – How to make Jetty webserver listen on port 80


I would like to use Jetty as a webserver.

I have edited the configuration file at /etc/default/jetty and set:

# change to 0 to allow Jetty start

# Listen to connections from this network host
# Use as host to accept all connections.

Now I can reach the Jetty webserver at but I would like to have Jetty listening on port 80.

I have tried this setting in the same configuration file:

# The network port used by Jetty

and then restart Jetty with sudo service jetty restart but it doesn't work.

How can I change so that the Jetty webserver is listening on port 80?

Best Answer

You will need to edit the /etc/jetty/jetty.xml file. Look for a paragraph that says:

<Call name="addConnector">
          <New class="org.mortbay.jetty.nio.SelectChannelConnector">
            <Set name="host"><SystemProperty name="jetty.host" /></Set>
            <Set name="port"><SystemProperty name="jetty.port" default="8090"/></Set>
            <Set name="maxIdleTime">30000</Set>
            <Set name="Acceptors">2</Set>
            <Set name="statsOn">false</Set>
            <Set name="confidentialPort">8443</Set>
        <Set name="lowResourcesConnections">5000</Set>
        <Set name="lowResourcesMaxIdleTime">5000</Set>

Change the jetty.port Property to 80 as follows:

<Set name="port"><SystemProperty name="jetty.port" default="80"/></Set>

Restart jetty. That should do it.

Since the above method did not work for OP, and running as root is discouraged, there is an alternative method, as mentioned in this document.

Related Question