Two. Configure Tomcat (case-sensitive) virtual host to build multiple web
1. Modify the configuration file Vim/usr/local/tomcat/conf/server.xml
Unpackwars= "true" autodeploy= "true" >
</Host>
Unpackwars= "true" autodeploy= "true" >
</Host>
2. Create a Web page
Configuration file can be seen in a file to be placed under Tomcat, combined with the default Web file to be placed under root; Create as follows
Mkdir-p/usr/local/tomcat/{a,b}/root (Create Virtual host Web page path)
echo AA >/usr/local/tomcat/a/root/index.html (write Web content)
echo BB >/usr/local/tomcat/b/root/index.html (write Web content)
The default condition to be placed in root can be manually modified, you need to send the following command to <Host> and </Host> Center
<context path= "" docbase= "base" reloadable= "true"/> So modified, is to put the Web page into the a/base file added
Three. Implementing path jumps
When the browser enters Www.a.com/test, the website provides the page from the/var/www/html/
<context path= "/test" docbase= "/var/www/html" reloadable= "true"/>
Four. HTTPS for encrypted website
- keytool-genkeypair-alias tomcat-keyalg rsa-keystore/usr/local/tomcat/keystore (Generate key)
#gen generate key
#alia S-alias
#keyalg algorithm
#keystore key storage location
2. Modify the main configuration file, add the generated key, (about 84 lines) Uncomment first "<!--" "--" and only the last
line needs to be added;
<connector port= "8443"
protocol= "Org.apache.coyote.http11.Http11NioProtocol"
maxthreads= "150" Sslenabled= "true" scheme= "https" secure= "true"
Clientauth= "false" sslprotocol= "TLS"
keystorefile= "/usr/ Local/tomcat/keystore "keystorepass=" 123456 "/>
3. Restart Service
/usr/local/tomcat/bin/shutdown.sh
/usr/local/ TOMCAT/BIN/STARTUP.SH
4. Client authentication, specifically indicating access to port 8443 because the open security port in the configuration file is 8443
https://www.a.com:8443
Five. Tomcat optimization
1. Concurrency optimization
Modify configuration file Vim/usr/local/tomcat/conf/server.xml (approximately 60 lines)
Add the following
<connector port= "8080" protocol= " http/1.1 "
maxthreads=" 1000 "Maximum number of threads
minsparethreads=" "
maxsparethreads=" "
Enablelookups=" false "
uriencoding=" Utf-8 "
acceptcount=" 1000 "Maximum number of queues
Tomcat builds the web and provides Java page access!