Jenkins access path is set to run in Tomcat

problem

Recently with Tomcatbuilt one Jenkins, but the time of the visit need to add the port /jenkins/to be accessed. We are directly Jenkins.war bag on webappsunder. We want to be directly accessed by without a path.

Solution

A thought

In the Hostconfigured path inside tested and found to be not acceptable.


<Host name="localhost"  appBase="webapps" path="/jenkins"
            unpackWARs="true" autoDeploy="true">
</Host>            

Thinking two (available)

Create a new directory in jenkins ./webapps/under ./webapps/jenkins. Jenkins.war then decompress it, then put all the content will be compressed bag ./webapps/jenkins/down, then ./conf/server.xmlthe Host
increase in a Contextconfiguration assumed that path /opt/apache-tomcat-8.5.47/webapps/jenkins, then configure

<Host name="localhost"  appBase="webapps" path="/"
            unpackWARs="true" autoDeploy="true">
        <!-- 新增-->    
        <Context docBase="/opt/apache-tomcat-8.5.47/webapps/jenkins" path="/"    reloadable="true"/>
        <!-- SingleSignOn valve, share authentication between web applications
             Documentation at: /docs/config/valve.html -->
        <!--
        <Valve className="org.apache.catalina.authenticator.SingleSignOn" />
        -->

        <!-- Access log processes all example.
             Documentation at: /docs/config/valve.html
             Note: The pattern used is equivalent to using pattern="common" -->
        <Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs"
               prefix="localhost_access_log" suffix=".txt"
               pattern="%h %l %u %t &quot;%r&quot; %s %b" />

      </Host>

Jenkins can then start.

Thinking three (available)

The jenkins.war decompression, and then compressed bag all the content on ./webapps/ROOT/the next, and then start jenkins.

[root@localhost webapps]# pwd
/opt/apache-tomcat-8.5.47/webapps
[root@localhost webapps]# ls -l ./ROOT/
total 2428
drwxr-x---  3 root root      36 Nov 10 18:22 bootstrap
-rw-r-----  1 root root    1946 Feb  7  2019 ColorFormatter.class
drwxr-x---  5 root root     265 Nov 10 18:22 css
-rw-r-----  1 root root    1544 Oct 28 13:22 dc-license.txt
drwxr-x---  2 root root      30 Nov 10 18:22 executable
-rw-r-----  1 root root   17542 Oct 28 13:22 favicon.ico
drwxr-x--- 12 root root     180 Nov 10 18:22 help
drwxr-x---  6 root root    4096 Nov 10 18:22 images
-rw-r-----  1 root root    1674 Feb  7  2019 JNLPMain.class
drwxr-x---  2 root root     250 Nov 10 18:22 jsbundles
-rw-r-----  1 root root     862 Feb  7  2019 LogFileOutputStream$1.class
-rw-r-----  1 root root     636 Feb  7  2019 LogFileOutputStream$2.class
-rw-r-----  1 root root    2240 Feb  7  2019 LogFileOutputStream.class
-rw-r-----  1 root root   20730 Feb  7  2019 Main.class
-rw-r-----  1 root root    1048 Feb  7  2019 MainDialog$1$1.class
-rw-r-----  1 root root    1067 Feb  7  2019 MainDialog$1.class
-rw-r-----  1 root root    2633 Feb  7  2019 MainDialog.class
-rw-r-----  1 root root     512 Feb  7  2019 Main$FileAndDescription.class
drwxr-x---  3 root root      94 Nov 10 18:22 META-INF
-rw-r-----  1 root root      71 Oct 28 13:22 robots.txt
drwxr-x---  3 root root     218 Nov 10 18:22 scripts
drwxr-x---  7 root root     275 Nov 10 18:22 WEB-INF
-rw-r-----  1 root root 2390099 May 12 15:50 winstone.jar

Reflection

  1. After this test, I found a point when we have the contents of the Root directory, we did not configure the time Context, we are to take the contents Root inside when we configured the content Context of the time, visit ip: port (default access), which is our path Context docBase configuration.
  2. default access under webapps Shi ROOT, the other in the webappsdirectory are needed to increase paths (ie, directory name), that is, when we specify a path Context inside docBase configuration, when it does not need to add this path.

Guess you like

Origin www.cnblogs.com/operationhome/p/11831286.html