How "Apache Tomcat" modifies the Tomcat default port 8080

Source: Internet
Author: User
Tags documentation server port tomcat server apache tomcat

We know that the Tomcat server uses the default port of 8080, and the default port for Oracle services in memory is also 8080, and if we are going to use the Oracle database to run on Tomcat at this point, there must be one that cannot use port 8080, and this time, You need to modify one of these. Let's look at how to modify the default port for Tomcat:

The configuration files for the tomcat server are stored in. \apache-tomcat-8.0.12\conf\, and the server port is set in the Server.xml file;

Now let's look at the original server.xml.

<?xml version= ' 1.0 ' encoding= ' utf-8 '?> <!--licensed to the Apache Software Foundation (ASF) under one or more  Contributor license agreements.
  The NOTICE file distributed with this work for additional information regarding copyright. The ASF licenses this file to you under the Apache License, Version 2.0 (the "License");  You are not to use this file except in compliance with the License.  Obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 unless required by applicable Agreed to writing, software distributed under the License was distributed on ' as is ' basis, without Warra
  Nties or CONDITIONS of any KIND, either express OR implied.
The License for the specific language governing permissions and limitations under the License.  --> <!--note:a "Server" isn't itself A "Container", so I/May isn't define subcomponents as "such" at
     This level. Documentation At/docs/config/server.html--> <server port= "8005" shutdown= "Shutdown" > <!--Security listener. Documentation at/docs/config/listeners.html <listener classname= "Org.apache.catalina.security.SecurityListener "/>--> <!--APR Library loader. Documentation at/docs/apr.html--> <listener classname= "Org.apache.catalina.core.AprLifecycleListener" Sslengine= ' on '/> <!--prevent memory leaks due to use of particular Java/javax apis--> <listener Classnam E= "Org.apache.catalina.core.JreMemoryLeakPreventionListener"/> <listener classname= " Org.apache.catalina.mbeans.GlobalResourcesLifecycleListener "/> <listener classname="  Org.apache.catalina.core.ThreadLocalLeakPreventionListener "/> <!--Global JNDI documentation at  /docs/jndi-resources-howto.html--> <GlobalNamingResources> <!--Editable User database that can also
    be used by Userdatabaserealm to authenticate users--><resource name= "Userdatabase" auth= "Container" type= "Org.apache.catalina.UserDatabase" desc ription= "User database" can be updated and saved "factory=" Org.apache.catalina.users.MemoryUserDatabaseF Actory "pathname=" Conf/tomcat-users.xml "/> </GlobalNamingResources> <!--a" Service "is a Collection of one or more ' connectors ' that share ' a single ' Container ' note:a ' Service ' is not itself a ' containe
       R ", so/may not define subcomponents such as" valves "at the This level. Documentation at/docs/config/service.html--> <service name= "Catalina" > <!--the connectors can use A shared executor, can define one or more named thread pools--> <!--<executor name= "Tomcatthreadpool "nameprefix=" catalina-exec-"maxthreads=" minsparethreads= "4"/>--> <!--A "Connector" rep
         Resents a endpoint by which requests are receivedand responses are returned. Documentation At:java HTTP Connector:/docs/config/http.html (Blocking & non-blocking) Java AJP C Onnector:/docs/config/ajp.html APR (HTTP/AJP) Connector:/docs/apr.html Define a Non-ssl http/1.1
               ctor on port 8080--> <connector port= "8080" protocol= "http/1.1" connectiontimeout= "20000" redirectport= "8443"/> <!--A "Connector" using the shared thread pool--> <!--<co Nnector executor= "Tomcatthreadpool" port= "8080" protocol= "http/1.1" connectiontimeout= "20000 "redirectport=" 8443 "/>--> <!--Define a SSL http/1.1 Connector on port 8443 Th is connector uses the NIO implementation that requires the JSSE style configuration. When using the apr/native implementation, the OpenSSL style configuration are required as described in the Apr/nat Ive DocumentatiOn--> <!--<connector port= "8443" protocol= "Org.apache.coyote.http11.Http11NioProtocol" M
    axthreads= "sslenabled=" "true" Scheme= "https" secure= "true" Clientauth= "false" sslprotocol= "TLS"/> --> <!--Define a AJP 1.3 Connector on port 8009--> <connector "port=" 8009 "protocol=" re  directport= "8443"/> <!--a Engine represents the entry point (within Catalina) that processes every  Request. The Engine implementation for Tomcat stand alone analyzes the HTTP headers with the request, and included
         them on to the appropriate host (virtual host).  Documentation At/docs/config/engine.html--> <!--you should set Jvmroute to support load-balancing via AJP IE : <engine name= "Catalina" defaulthost= "localhost" jvmroute= "jvm1" >--> <engine name= "Catalina" de faulthost= "localhost" > <!--for clustering, please take a Look at documentation in:/docs/cluster-howto.html (Simple to)/docs/config/cluster.html (refere
      NCE documentation)--> <!--<cluster classname= "Org.apache.catalina.ha.tcp.SimpleTcpCluster"/> --> <!--Use the Lockoutrealm to prevent attempts to guess user passwords via a brute-force att Ack--> <realm classname= "Org.apache.catalina.realm.LockOutRealm" > <!--this Realm uses the User  The Database configured in the global JNDI under the key "Userdatabase". Any edits so are performed against this userdatabase are immediately  Realm. --> <realm classname= "Org.apache.catalina.realm.UserDatabaseRealm" resourcename= "Userdatabase" "/> </Realm>  

The following section, which is defined as the default port 8080, is where we modify the default port and can be modified to other ports.

To avoid port usage conflicts.

<!--A "Connector" represents A endpoint by which requests are received and responses are  
         . Documentation at:  
         java HTTP Connector:/docs/config/http.html (Blocking & non-blocking)  
         java AJP  Connector:/docs/config/ajp.html  
         APR (HTTP/AJP) Connector:/docs/apr.html Define  
         a Non-ssl http/1.1 On port 8080  
    -->  
    <connector port= "  
               8080" protocol= "http/1.1" connectiontimeout= "20000" redirectport= "8443"/>  

If necessary, you can study the following additional settings.



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.