Jetty9 Configuration Guide and Jetty9 Deploy Jenkins

jetty download link:

https://www.eclipse.org/jetty/ download.html

Jetty installation: span>

Download the specified directory where the .tgz package is unzipped

For example: unzip the jetty-distribution-9.4.6.v20170531.tar.gz package Compress it to the /usr/local/jetty directory.

By default, we regard the root directory of jetty as $JETTY_HOME

jetty directory structure:

[root@ localhost jetty01]#lltotal 712drwxr-xr-x 2 root root 4096 Sep 1 14:59 bindrwxr-xr-x 7 root root 4096 Sep 1 14:53 demo-basedrwxr-xr-root 3 14 4096 Sep 14 -rw-r--r-- 1 root root 198 Sep 1 16:19 jetty01.statedrwxr-xr-x 13 root root 4096 Sep 1 14:53 lib-rw-r--r-- 1 root root 30012 Sep 1 14:53 license-eplv10-aslv20.htmldrwxr-xr-x 2 root root 4096 Sep 1 14:53 logsdrwxr-xr-x 19 root root 4096 Sep 1 14:53 modules-rw-r--rroot-- 1 root 6262 Sep 1 14:53 notice.html-rw-r--r-- 1 root root 1637 Sep 1 14:53 README.TXTdrwxr-xr-x 2 root root 4096 Sep 1 14:53 resources-rw-r-- r-- 1 root root 5702 Sep 1 14:53 start.ini-rw-r--r-- 1 root root 147725 Sep 1 14:53 start.jar-rw-r--r-- 1 root root 483631 Sep 1 14:53 VERSION.txtdrwxr-xr-x 2 root root 40 96 Sep 1 16:36 webapps

Introduction to directories and files

Location Description

license-eplv10-aslv20.html

Jetty’s license file

README.txt

Useful starting information

VERSION.txt

version information

bin/

shell scripts stored in Unix systems

demo-base/

td>

A base directory of Jetty server that can run with sample web applications

etc/

Jetty’s configuration file

lib/

Jar files necessary for Jetty operation

logs/

Log

modules/

each module

notice.html

License information etc.

resources/

Includes the configuration folder added to the classpath, such as log4j.properties

start.ini

Store startup information

start.jar

Run Jetty jar

webapps/

A directory used to store Jetty web applications running in the default configuration

< br>

Important directories and files:

bin/jetty.sh: Jetty service start/stop script, mainly with the following variable configuration

JAVA : Set the absolute path of the java command, that is, the path of the java command in the bin directory of jdk. If it is not set, look it up from the PATH environment variable; JAVA_OPTIONS: set jvm parameters; JETTY_HOME: the installation directory of jetty, if not set, then Guess from the context in which the script is called; JETTY_BASE: the base directory of jetty, that is, the root directory of the jetty environment used by the current project. If not set, it is the same as JETTY_HOME; JETTY_RUN: configure the path to save the jetty pid file, if not configured , Search for the first available directory according to the following order: /var/run, /usr/var/run, JETTY_BASE, /tmp; JETTY_PID: pid file path, default: $JETTY_RUN/$NAME.pid (NAME variable means starting jetty JETTY_ARGS: jetty parameters, such as configuration port number, etc.: JETTY_ARGS=8080 jetty.spdy.port=8443 JETTY_USER: configuration startup user, such as startup as nkcoder user: JETTY_USER=nkcoder

< p>

jetty operation:

Command Start by way:

cd $JETTY_HOMEjava-jar start.jar

This command can be executed requires $JETTY_HOME There is a start.ini file. The jetty service startup information is stored in the changed file.

start. The default configuration of the ini file is as follows:

 cat start.ini|egrep-v"^#|^$"--module=home-base -warning--module=ext--module=server--module=jsp--module=resources--module=deploy--module=jstl--m odule=websocket--module=http

After starting jetty through the above command, enter http://localhost:8080 in the browser to access jetty, and the following appears Error page

Basic application example:

cd $JETTY_HOME/demo-base/java-jar $JETTY_HOME/start.jar

Visit http://localhost:8080 You can watch now To a Jetty welcome page, the page contains a few simple examples, the welcome page is as follows

#ll demo-base/total 20drwxr-xr-x 2 root root 4096 Sep 1 14:53 etcdrwxr-xr-x 3 root root 4096 Sep 1 14:53 libdrwxr-xr-x 2 root root 4096 Sep 1 14:53 resourcesdrwxr-xr-x 2 root root 4096 Sep 1 14:53 start.ddrwxr-xr-x 5 root root 4096 Sep 1 14:53 pre>


How Jetty deploys web applications

< p>Put the project to be deployed (war package, project directory or xml description file) in the webapps directory of ${JETTY_HOME};

Note that:< /p>

Jetty will automatically deploy almost all war packages, directories, and xml files in the webapps directory (with some exceptions, such as hidden files and directories ending with .d will be ignored).

< p>If the war package, the directory and the xml file have the same name, the deployment order is xml file> war package> directory. For example, the webapps directory includes rank.war, rank directory and rank.xml, where the rank directory is rank.war The decompressed directory, rank.xml refers to the rank.war package or the rank directory. At this time, only the xml file is deployed. The premise here is the same name. If they have different names, but they are the same project, then Will cause the project to be deployed repeatedly, remember!


    < li>< p>For example, an example/ folder containing WEB-INF/ subfolders is deployed as a standard web application, otherwise it is deployed as a static resource, and the context path is /example (access path: http://localhost:8080 /example/); if the folder name is ROOT, the access path is /; if the end of the folder name is .d, the folder is ignored (unless it is referenced by a special configuration file)

    < li>

    If a file example.war is deployed under webapps, the context path is example/, if the name is ROOT, the access path is /, if the example.war file and the example/ folder exist at the same time, only the war file Will be deployed (this file will be used as a directory that has not been decompressed)

  • A configuration file like example.xml, if the file contains standard configuration information, It will also be deployed. The file must contain the context path. If the context path and example.xml exist at the same time, only example.xml will be deployed.

   If you have a standard web application, you can directly copy it to the webapps folder for hot deployment.


Look at the files in the demo-base/webapps directory

#ls-l webapps/total 3624-rw-r--r-- 1 root root 986372 Sep 1 14:53 async-rest.wardrwxr-xr-x 3 root root 4096 Sep 1 14:53 doc-rw-r--r-- 1 root root 533 Sep 1 14:53 example-moved.xml-rw-r--r-- 1 root root 341 Sep 1 14:53 README.TXTdrwxr-xr-x 3 root root 4096 Sepr- 1 14:w 53 xr-x 2 root root 4096 Sep 1 14:53 test.d-rw-r--r-- 1 root root 60716 Sep 1 14:53 test-jaas.war-rw-r--r-- 1 root root 945 Sep 1 14:53 test-jaas.xml-rw-r--r-- 1 root root 62949 Sep 1 14:53 test-jndi.war-rw-r--r-- 1 root root 3430 Sep 1 14 :53 test-jndi.xml-rw-r--r-- 1 root root 517192 Sep 1 14:53 test-spec.war-rw-r--r-- 1 root root 2456 Sep 1 14:53 test- spec.xml-rw-r--r-- 1 root root 1012480 Sep 1 14:53 test.war-rw-r--r-- 1 root root 4623 Sep 1 14:53 test.xml-rw-r- -r-- 1 root root 1018072 Sep 1 14:53 xref-proxy.war

File introduction in webapps:

ROOT/: This folder contains various static resources. Contains the Jetty welcome page, the default access path is /test.d: a folder containing additional configuration files, used by test.xml to add additional configuration to test.war test.xml: a context configuration file for configuration And deploy test.war, including context environment and additional configuration information for the configuration in test.d test.war: sample web program configured in test.xml async-rest.war: an asynchronous sample web application test-jaas .war: A web application that uses JAAS authentication. test-jaas.xml: The configuration file used to configure test-jaas.war test-jndi.war: A sample application using JNDI test-jndi.xml: The configuration file test-spec used to configure test-jndi.war. war: An example application using annotations, ServletContainerInitializers and Servlet 3.0/3.1 specifications test-spec.xml: a configuration file used to configure test-spec.war xref-proxy.war: an example application example-moved.xml using proxy : A sample application that demonstrates the use of MovedContextHandler redirection

Summary:< /strong>

There are many war packages and xml files with the same name in the demo-base/webapps directory, such as:

test.war and test.xml, test-jaas.war and test -jaas.xml

These two files can be regarded as a group. When jetty deploys the war package, it needs an xml file with the same name, which saves the configuration of the war package

The content of a simple xml file is as follows:

/jenkins/webapps/jenkins.war   New class=" " /realm.properties    

contextPath configures the path when accessing the web application, and the configuration above is /jenkins, so when accessing the modified application, the path is < /p>

http://172.16.42.178:8181/jenkins/

The following takes jetty9 to deploy jenkins as an example Jetty9 use configuration

Enter the $JETTY_HOME/webapps directory. Copy jenkins.war to this directory, create a jenkins.xml file, and configure it as the above file. Just start the jetty service.

#lltotal 63180-rwxr-xr-x 1 root root 64685923 Sep 1 16:04 jenkins.war-rw-r--r-- 1 root root 642 Sep 1 16:26 jenkins.xml-rw-r--r-- 1 root root 1412 Sep 1 14:53 README.TXT

Reference link :

https://nkcoder.github.io/2014/06/18/jetty-deploy-help/

http://www.cnblogs.com/yiwangzhibujian/p /5832597.html

WordPress database error: [Table 'yf99682.wp_s6mz6tyggq_comments' doesn't exist]
SELECT SQL_CALC_FOUND_ROWS wp_s6mz6tyggq_comments.comment_ID FROM wp_s6mz6tyggq_comments WHERE ( comment_approved = '1' ) AND comment_post_ID = 4552 ORDER BY wp_s6mz6tyggq_comments.comment_date_gmt ASC, wp_s6mz6tyggq_comments.comment_ID ASC

Leave a Comment

Your email address will not be published.