In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/02 Report--
Tomcat virtual host configuration
Sometimes, when a company has multiple projects running at the same time, it is not recommended to run multiple Tomcat services on one server. Virtual hosts need to be configured.
Access to different project content through two domain names
Steps
1. Create www and bbs project directories and files.
two。 Modify the Tomcat main configuration file
3. Restart the Tomcat service
4. test
Tomcat optimization
Tomcat optimization
The default configuration of Tomcat is not suitable for the production environment, it will frequently appear fake death phenomenon and need to be rebooted. Only through continuous stress testing and optimization can it run stably and efficiently. There are three main aspects of optimization, including operating system optimization (kernel parameter optimization), Tomcat profile parameter optimization, Java virtual machine (JVM) tuning.
Optimization related parameters commonly used in Tomcat
[maxThreads] Tomcat uses a thread to process each request received, a value that represents the most
Large number of threads, the default value is 200.
[minSpareThreads] the minimum number of idle threads, the number of threads initialized when Tomcat starts, indicating that even if there is no
People use to open so many empty threads to wait, the default value is 10
[maxSpareThreads] maximum number of standby threads. Once the created thread exceeds this value, Tomcat will close no
The socket thread that is needed again. The default value is-1 (unlimited). Generally, there is no need to specify
[URIEncoding] specifies the URL encoding format of the Tomcat container. The language encoding format is not as good as other Web.
The server software is easy to configure and needs to be specified separately
[connnectionTimeout] Network connection timeout (in milliseconds). Set to 0 means never time out. Set it like this
There are hidden dangers. Usually the default is 20000 milliseconds.
[enableLookups] whether to reverse check the domain name to return the hostname of the remote host. Value: true or false
If set to false, the IP address is returned directly. To improve processing power, it should be set to false.
[disableUploadTimeout] whether to use timeout mechanism when uploading. Should be set to true.
[connectionUploadTimeout] upload timeout. After all, file upload may take more time.
This is adjusted according to your own business needs, so that Servlet has a longer time to complete its execution.
It will not take effect until used in conjunction with the previous parameter.
[acceptCount] specifies that connection requests can be passed in when all available threads for processing requests are used
The maximum queue length of the. Requests beyond this number will not be processed. The default is 100.
[compression] whether to perform GZIP compression on the response data. Off: disable compression; on: allow
Compression (text will be compressed), force: compression is performed in all cases. The default value is off, and data is compressed.
After that, it can effectively reduce the size of the page, generally, it can be reduced by about 1 inch, saving bandwidth.
[compressionMinSize] represents the minimum value of the compressed response, only when the response message size is greater than this value.
The message will be compressed. If the compression function is enabled, the default value is 2048.
[compressableMimeType] Compression type, which specifies which types of files are compressed.
[noCompressionUserAgents= "gozilla, traviata"] Compression is not enabled for the following browsers
Experimental procedure
Install and configure domain name resolution service
[root@localhost ~] # yum install bind-y
[root@localhost ~] # vim / etc/named.conf
Listen-on port 53 {any;}
...
Allow-query {any;}
[root@localhost ~] # vim / etc/named.rfc1912.zones
Zone "kgc.com" IN {
Type master
File "kgc.com.zone"
Allow-update {none;}
}
Zone "accp.com" IN {
Type master
File "accp.com.zone"
Allow-update {none;}
}
[root@localhost ~] # cd / var/named/
[root@localhost named] # cp-p named.localhost kgc.com.zone
[root@localhost named] # vim kgc.com.zone
$TTL 1D
@ IN SOA @ rname.invalid. (
0; serial
1D; refresh
1H; retry
1W; expire
3H); minimum
NS @
A 127.0.0.1
Www IN A 192.168.235.158
[root@localhost named] # cp-p kgc.com.zone accp.com.zone
# copy kgc file and rename it to accp file without modification
[root@localhost named] # systemctl start named
# start the domain name resolution service
[root@localhost named] # systemctl stop firewalld.service
[root@localhost named] # setenforce 0
# turn off firewall and enhanced security features
Create kgc and accp project directories and files
[root@localhost named] # mkdir / usr/local/tomcat/webapps/kgc
# create a kgc site directory
[root@localhost named] # echo "This is kgc web" > / usr/local/tomcat/webapps/kgc/index.jsp
# Editing the kgc home page
[root@localhost named] # mkdir / usr/local/tomcat/webapps/accp
[root@localhost named] # echo "This is accp web" > / usr/local/tomcat/webapps/accp/index.jsp
Modify Tomcat main configuration file server.xml
[root@localhost named] # vim / usr/local/tomcat/conf/server.xml
# define www.kgc.com virtual host configuration
# close the xml namespace # specify the classes loaded by path by default and turn on the reloadable monitoring class # Note the closing of the label # define the www.accp.com virtual host configuration
[root@localhost named] # shutdown.sh # off
Using CATALINA_BASE: / usr/local/tomcat
Using CATALINA_HOME: / usr/local/tomcat
Using CATALINA_TMPDIR: / usr/local/tomcat/temp
Using JRE_HOME: / usr/java/jdk1.8.0_201-amd64
Using CLASSPATH: / usr/local/tomcat/bin/bootstrap.jar:/usr/local/tomcat/bin/tomcat-juli.jar
[root@localhost named] # startup.sh # enable Tomcat service
Using CATALINA_BASE: / usr/local/tomcat
Using CATALINA_HOME: / usr/local/tomcat
Using CATALINA_TMPDIR: / usr/local/tomcat/temp
Using JRE_HOME: / usr/java/jdk1.8.0_201-amd64
Using CLASSPATH: / usr/local/tomcat/bin/bootstrap.jar:/usr/local/tomcat/bin/tomcat-juli.jar
Tomcat started.
Browse the test web page
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.