Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Jetty (Eclipse) listening on multiple IPs

Tags:

jetty

1) what's the equivalent configuration in Jetty to listen on multiple IPs, as the Listen directive in Apache?

2) How can a sub-domain be configured with different context path?

like image 217
Vjy Avatar asked Oct 25 '25 23:10

Vjy


1 Answers

Question 1.

Assuming you're configuring using a jetty.xml file, then you'll have something in there that looks a bit like this:

<Call name="addConnector">
  <Arg>
    <New class="org.eclipse.jetty.server.nio.SelectChannelConnector">
      <Set name="host"><Property name="jetty.host" /></Set>
      <Set name="port"><Property name="jetty.port" default="8080"/></Set>
      <Set name="maxIdleTime">300000</Set>
      <Set name="Acceptors">2</Set>
      <Set name="statsOn">false</Set>
      <Set name="confidentialPort">8443</Set>
      <Set name="lowResourcesConnections">20000</Set>
      <Set name="lowResourcesMaxIdleTime">5000</Set>
    </New>
  </Arg>
</Call> 

You'll need one connector for each IP you want to listen on. So, just duplicate that section as many times as you need. Then for each of them replace the line

   <Set name="host"><Property name="jetty.host" /></Set>

with

   <Set name="host">www.xxx.yyy.zzz</Set>

where www.xxx.yyy.zzz is the IP you want to listen on.

Question 2.

See

  • Possible to map subdomains to webapps in a standard Java app server?
  • http://wiki.eclipse.org/Jetty/Howto/Configure_Virtual_Hosts
like image 98
Tim Avatar answered Oct 28 '25 03:10

Tim



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!