Install and use jetty-9.4.0 under "containers" CentOS7.2

Source: Internet
Author: User
Tags deprecated prepare centos server tomcat
Origin

Always use Tomcat to make containers. But recently played the spring boot, see the internal integration of the jetty play, and then to build a jetty. Through the configuration and use, the purpose is to let oneself master another kind of container, later convenient for business migration microservices to service it. Prepare

A: Download Resources Select the latest tgz package.
B: Prepare the CentOS server.
C:yum your favorite editor. I was using VIM. Steps

One, download it under the custom path and rename it.

wget http://central.maven.org/maven2/org/eclipse/jetty/jetty-distribution/9.4.0.v20161208/ jetty-distribution-9.4.0.v20161208.tar.gz

MV jetty-distribution-9.4.0.v20161208 jetty-9.4.0

Two, the simplest operation.
Enter into the bin and then discover that there is jetty.sh and then start:

Cd/usr/local/jetty/jetty-9.4.0/bin
./jetty.sh start

You can open the interface.
The startup is an empty project.

Error 404-not Found.

No context on the this server matched or handled this request.
Contexts known to this server is:
 Powered by jetty://9.4.0.v20161208

Third, the preliminary study jetty.xml.

First part connection pool configuration

    <arg name= "ThreadPool" ><new id= "ThreadPool" class= "Org.eclipse.jetty.util.thread.QueuedThreadPool"/> </Arg>
    <get name= "ThreadPool" >
      <set name= "minthreads" type= "int" >< Property Name= "Jetty.threadPool.minThreads" deprecated= "Threads.min" default= "/></set> <set"
      Name= "MaxThreads" type= "int" ><property name= "jetty.threadPool.maxThreads" deprecated= "Threads.max" default= " "/></set>
      <set name=" idleTimeout "type=" int "><property name=" Jetty.threadPool.idleTimeout "deprecated=" Threads.timeout "default=" 60000 "/></set>
      <set name=" Detaileddump ">false</Set>
    </Get>

The relevant tuning can be started here.

the second part of the configuration for HTTPS

<new id= "Httpconfig" class= "org.eclipse.jetty.server.HttpConfiguration" >
      <set name= "Securescheme" ><property name= "Jetty.httpConfig.secureScheme" default= "https"/></set>
      <set name= " Secureport "><property name=" Jetty.httpConfig.securePort "deprecated=" Jetty.secure.port "default=" 8443 "/> </Set>

Of course, we don't normally configure HTTPS inside the container.

Part III for input and output streams and HTTP access header related Settings

 <set name= "outputbuffersize" ><property name= "jetty.httpConfig.outputBufferSize" deprecated= " Jetty.output.buffer.size "default=" 32768 "/></set> <set name=" outputaggregationsize "><property na Me= "Jetty.httpConfig.outputAggregationSize" deprecated= "Jetty.output.aggregation.size" default= "8192"/></ set> <set name= "requestheadersize" ><property name= "jetty.httpConfig.requestHeaderSize" deprecated= " Jetty.request.header.size "default=" 8192 "/></set> <set name=" responseheadersize "><property name=
      "Jetty.httpConfig.responseHeaderSize" deprecated= "Jetty.response.header.size" default= "8192"/></set> <set name= "sendserverversion" ><property name= "jetty.httpConfig.sendServerVersion" deprecated= " Jetty.send.server.version "default=" true "/></set> <set name=" Senddateheader "><property name=" jet Ty.httpConfig.sendDateHeader "deprecated=" Jetty.send.date.header "default=" false "/></set> <set name= "headercachesize" ><property name= "jetty.httpConfig.headerCacheSize" default= "512" /></set>

The control of convection can be tuned here.

Part Fourth additional service settings

<set name= "Stopatshutdown" ><property name= "Jetty.server.stopAtShutdown" default= "true"/></set>
    <set name= "stoptimeout" ><property name= "Jetty.server.stopTimeout" default= "the"/></set>
    <set name= "Dumpafterstart" ><property name= "Jetty.server.dumpAfterStart" deprecated= " Jetty.dump.start "default=" false "/></set>
    <set name=" dumpbeforestop "><property name=" Jetty.server.dumpBeforeStop "deprecated=" Jetty.dump.stop "default=" false "/></set>

This is primarily for settings that are closed after the service has been stopped, and expiration related.

Four, of course, under the entire configuration path, you can also see some familiar faces, such as gzip compression configuration, etc., feel that if you play Tomcat optimization classmate, should not be unfamiliar.

Five, for basic needs, such as changing the port such things, inevitable. However, it seems that 9.4.0 has been updated with the configuration file. Originally configured in the jetty.xml can be done, but the latest version of the text to see the description.

   <!--===========================================================--<!--Http Configuration. -<!--This is a common configuration instance used by all--and &LT ;! --connectors that can carry HTTP semantics (HTTP, HTTPS, etc.)                                                   -<!--It configures the non wire protocol aspects of the HTTP--<!--semantic. 
    -<!---->  <!--This configuration are only defined here and are used by--<!--reference from the other XML files such as Jetty-http.xml,-<!--jetty-https.xml and other configuration files which--&L t;!                                 --Instantiate the connectors. -<!----> <!--Consult the Javadoc of O . e.j.server.httpcOnfiguration-<!--for all configuration, the May is set here. -<!--===========================================================--

More clearly, if the file does not have content, to jetty-http or HTTPS settings.

So, we found jetty-http.xml.
You can see that the settings for host and default port 8080 are already in place.

      <set name= "host" ><property name= "Jetty.http.host" deprecated= "Jetty.host"/></set>
        <set Name= "Port" ><property name= "Jetty.http.port" deprecated= "Jetty.port" default= "8080"/></set>

Make the changes here, and then reboot.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.