Refer to the website: www.cnblogs.com/gdjlc/p/110…
Example Modify the port attribute of Connector
<Connector port="8080" protocol="HTTP / 1.1"
connectionTimeout="20000"
redirectPort="8443" />
Copy the code
Port 8080 changed to 80
<Connector port="80" protocol="HTTP / 1.1"
connectionTimeout="20000"
redirectPort="8443" />
Copy the code
Change the name attribute of the Engine node
<Engine name="Catalina" defaultHost="localhost">
Copy the code
Change localhost to the domain name, for example, xxx.com
<Engine name="Catalina" defaultHost="xxx.com">
Copy the code
Example Modify the name attribute of the Host controller
<Host name="localhost" appBase="webapps" unpackWARs="true" autoDeploy="true">
Copy the code
Change localhost to the domain name
<Host name="xxx.com" appBase="webapps"
unpackWARs="true" autoDeploy="true">
Copy the code
Restart the tomcat
Open the gzip
<Connector port="80" protocol="HTTP / 1.1"
connectionTimeout="20000"
redirectPort="8443"
compression="on"
compressionMinSize="2048"
noCompressionUserAgents="gozilla, traviata"
compressableMimeType="text/html,text/xml,text/plain,text/css,text/javascript,text/json,application/x-javascript,application/javascript,applic ation/json"
/>
Copy the code
-
Compression =”on” Enable Gzip compression, default is off
-
Use compressionMinSize=”2048″ to compress files larger than 2KB, which consumes CPU performance. Use compressionMinSize only for resources larger than 2KB, which is officially recommended.
-
NoCompressionUserAgents =”gozilla, Traviata “, for both browsers, no compression is performed;
-
compressableMimeType=”text/html,text/xml,text/plain,text/css,text/javascript,text/json,application/x-javascript,applicat Ion/javascript, application/json “suggests that support HTML, XML, js, CSS, and json compressed file format
Note: Do not add image types, because images such as JPG are compressed.