标签:介绍 大于 压缩 rsa 环境 add 虚拟机 ttl force
Tomcat介绍[root@localhost ~]# mount.cifs //192.168.100.10/tomcat /mnt //将存有tomcat的工具挂载到mnt目录
Password for root@//192.168.100.10/tomcat:
[root@localhost ~]# cd /mnt //进入mnt目录
[root@localhost mnt]# ls //查看是否成功挂载
12D18CFCD6599AFF0445766ACC4CA231C5025773.torrent apache-tomcat-9.0.16.tar.gz
apache-jmeter-5.1 jdk-8u201-linux-x64.rpm
apache-jmeter-5.1.zip tomcat优化压测.jmx
[root@localhost mnt]# rpm -ivh jdk-8u201-linux-x64.rpm //安装jdk包
警告:jdk-8u201-linux-x64.rpm: 头V3 RSA/SHA256 Signature, 密钥 ID ec551f03: NOKEY
准备中... ################################# [100%]
正在升级/安装...
1:jdk1.8-2000:1.8.0_201-fcs ################################# [100%]
Unpacking JAR files...
tools.jar...
plugin.jar...
javaws.jar...
deploy.jar...
rt.jar...
jsse.jar...
charsets.jar...
localedata.jar...
[root@localhost mnt]# cd /usr/java/ //进入Java安装目录
[root@localhost java]# ls
default jdk1.8.0_201-amd64 latest
[root@localhost java]# cd jdk1.8.0_201-amd64/ //进入jdk目录
[root@localhost jdk1.8.0_201-amd64]# ls
bin jre README.html THIRDPARTYLICENSEREADME.txt
COPYRIGHT lib release
include LICENSE src.zip
javafx-src.zip man THIRDPARTYLICENSEREADME-JAVAFX.txt
[root@localhost jdk1.8.0_201-amd64]# pwd //查看当前位置
/usr/java/jdk1.8.0_201-amd64 //复制此条目
[root@localhost jdk1.8.0_201-amd64]# vim /etc/profile //编辑profile文件进行参数更新
export JAVA_HOME=/usr/java/jdk1.8.0_201-amd64 //声明变量位置
export CLASSPATH=$JAVA_HOME/lib/tools.jar:$JAVA_HOME/lib/dt.jar //声明CLASS变量
export PATH=$JAVA_HOME/bin:$PATH //声明环境变量
:qw
[root@localhost jdk1.8.0_201-amd64]# source /etc/profile //执行profile文件
[root@localhost jdk1.8.0_201-amd64]# java -version //查看Java版本,测试Java是否安装成功
java version "1.8.0_201"
Java(TM) SE Runtime Environment (build 1.8.0_201-b09)
Java HotSpot(TM) 64-Bit Server VM (build 25.201-b09, mixed mode)
root@localhost jdk1.8.0_201-amd64]# cd /mnt
[root@localhost mnt]# ls
12D18CFCD6599AFF0445766ACC4CA231C5025773.torrent apache-tomcat-9.0.16.tar.gz
apache-jmeter-5.1 jdk-8u201-linux-x64.rpm
apache-jmeter-5.1.zip tomcat优化压测.jmx
[root@localhost mnt]# tar zxvf apache-tomcat-9.0.16.tar.gz -C /usr/local/ //解压tomcat文件到/usr/local目录
[root@localhost mnt]# cd /usr/local/
[root@localhost local]# ls
apache-tomcat-9.0.16 bin etc games include lib lib64 libexec sbin share src
[root@localhost local]# mv apache-tomcat-9.0.16/ tomcat //将文件更名
[root@localhost local]# cd tomcat/ //进入tomcat目录
[root@localhost tomcat]# ls
bin conf lib logs README.md RUNNING.txt webapps
BUILDING.txt CONTRIBUTING.md LICENSE NOTICE RELEASE-NOTES temp work
[root@localhost tomcat]# cd bin //进入命令存放目录
[root@localhost bin]# ls
bootstrap.jar commons-daemon-native.tar.gz makebase.sh tomcat-juli.jar
catalina.bat configtest.bat setclasspath.bat tomcat-native.tar.gz
catalina.sh configtest.sh setclasspath.sh tool-wrapper.bat
catalina-tasks.xml daemon.sh shutdown.bat tool-wrapper.sh
ciphers.bat digest.bat shutdown.sh version.bat
ciphers.sh digest.sh startup.bat version.sh
commons-daemon.jar makebase.bat startup.sh
[root@localhost bin]# ln -s /usr/local/tomcat/bin/startup.sh /usr/bin/ //将软件启动脚本建立软连接到系统命令目录下
[root@localhost bin]# ln -s /usr/local/tomcat/bin/shutdown.sh /usr/bin/ //将关闭软件脚本建立软连接到系统命令目录下
[root@localhost bin]# systemctl stop firewalld.service //关闭防火墙
[root@localhost bin]# setenforce 0 //关闭增强性安全功能
[root@localhost bin]# startup.sh //使用命令启动tomcat服务(可以使用TAB键补全哦)
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.
[root@localhost bin]# netstat -ntap | grep 8080 //使用命令查看端口是否开启
tcp6 0 0 :::8080 :::* LISTEN 3137/java
[root@localhost bin]# shutdown.sh //关闭软件
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.j
[root@localhost security]# cd /usr/java/jdk1.8.0_201-amd64/jre/lib/security/ //进入Java目录
[root@localhost security]# vim java.security //修改jdk参数,优化tomcat启动速度
...//省略部分内容...
# In addition, if "file:/dev/random" or "file:/dev/urandom" is
# specified, the "NativePRNG" implementation will be more preferred than
# SHA1PRNG in the Sun provider.
#
securerandom.source=file:/dev/urandom //random更改为urandom优化tomcat启动速度
...//省略部分内容...
:wq
[root@localhost security]# startup.sh //再次启动,启动速度加快
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.
[root@localhost security]# yum install -y bind //安装DNSfuwu
Loaded plugins: fastestmirror, langpacks
base | 3.6 kB 00:00:00
extras | 2.9 kB 00:00:00
...//省略部分内容...
Installed:
bind.x86_64 32:9.11.4-9.P2.el7
...//省略部分内容...
Complete!
[root@localhost conf]# vim /etc/named.conf //编辑修改DNS服务主配置文件
...//省略部分内容...
options {
listen-on port 53 { any; };
listen-on-v6 port 53 { ::1; };
directory "/var/named";
dump-file "/var/named/data/cache_dump.db";
statistics-file "/var/named/data/named_stats.txt";
memstatistics-file "/var/named/data/named_mem_stats.txt";
recursing-file "/var/named/data/named.recursing";
secroots-file "/var/named/data/named.secroots";
allow-query { any; };
...//省略部分内容...
:wq
[root@localhost conf]# vim /etc/named.rfc1912.zones //编辑修改DNS服务区域配置文件
...//省略部分内容...
zone "kgc.com" IN {
type master;
file "kgc.com.zone";
allow-update { none; };
};
...//省略部分内容...
:wq
[root@localhost conf]# cd /var/named/ //进入DNS服务区域数据文件存放目录
[root@localhost named]# cp -p named.localhost kgc.com.zone //复制区域数据文件模板
[root@localhost named]# vim kgc.com.zone //编辑修改DNS服务区域数据配置文件
$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.144.133
:wq
[root@localhost named]# systemctl start named //启动DNS服务
[root@localhost conf]# vim /etc/named.rfc1912.zones //编辑DNS服务区域配置文件
...//省略部分内容...
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; };
};
...//省略部分内容...
:wq
[root@localhost conf]# cd /var/named/ //进入区域数据文件目录
[root@localhost named]# cp -p kgc.com.zone accp.com.zone //复制DNS服务区域数据配置文件
[root@localhost named]# systemctl restart named //重启DNS服务
[root@localhost named]# cd ~
[root@localhost ~]# cd /usr/local/tomcat/ //进入tomcat目录文件
[root@localhost tomcat]# ls
bin conf lib logs README.md RUNNING.txt webapps
BUILDING.txt CONTRIBUTING.md LICENSE NOTICE RELEASE-NOTES temp work
[root@localhost tomcat]# cd webapps/ //进入服务网页站点
[root@localhost webapps]# ls
docs examples host-manager manager ROOT
[root@localhost webapps]# mkdir kgc //创建目录
[root@localhost webapps]# echo "this is kgc web" > kgc/index.jsp //编辑主页文件
[root@localhost webapps]# mkdir accp //创建目录
[root@localhost webapps]# echo "this is accp web" > accp/index.jsp //编辑主页文件
[root@localhost webapps]# tree accp/ kgc/ //使用命令以树形结构查看目录
accp/
└── index.jsp
kgc/
└── index.jsp
[root@localhost webapps]# cd ../conf/ //进入tomcat配置文件存放目录
[root@localhost conf]# ls
Catalina catalina.properties jaspic-providers.xml logging.properties tomcat-users.xml web.xml
catalina.policy context.xml jaspic-providers.xsd server.xml tomcat-users.xsd
[root@localhost conf]# vim server.xml //编辑配置文件,编辑虚拟主机配置
...//省略部分内容...
<Host name="www.accp.com" appBase="webapps" unpackWARs="true" autoDeploy="true" xmlValidation="false" xmlNamespaceAware="false">
<Context docBase="/usr/local/tomcat/webapps/accp" path="" reloadable="true"/>
</Host>
<Host name="www.kgc.com" appBase="webapps" unpackWARs="true" autoDeploy="true" xmlValidation="false" xmlNamespaceAware="false">
<Context docBase="/usr/local/tomcat/webapps/kgc" path="" reloadable="true"/>
</Host>
...//省略部分内容...
:wq
[root@localhost conf]# shutdown.sh //关闭tomcat服务
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 conf]# startup.sh //启动tomcat服务
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.
【noCompressionUserAgents="gozilla, traviata"】对于以下的浏览器,不启用压缩
[root@localhost conf]# vim server.xml //编辑tomcat配置文件
...//省略部分内容...
<!-- A "Connector" represents an endpoint by which requests are received
and responses are returned. Documentation at :
Java HTTP Connector: /docs/config/http.html
Java AJP Connector: /docs/config/ajp.html
APR (HTTP/AJP) Connector: /docs/apr.html
Define a non-SSL/TLS HTTP/1.1 Connector on port 8080
-->
<Connector port="8080" protocol="HTTP/1.1"
connectionTimeout="20000"
redirectPort="8443"
minSpareThreads="50"
enableLookups="false" //添加优化条目
disableUploadTimeout="true"
acceptCount="300"
maxThreads="500"
processorCache="500"
URIEncoding="UTF-8"
compression="on"
compressionMinSize="2048"
compressableMimeType="text/html,text/xml,text/javascript,text/css,text/plain,image/gif,image /jpg,image/png"/>
<!-- A "Connector" using the shared thread pool-->
<!--
<Connector executor="tomcatThreadPool"
port="8080" protocol="HTTP/1.1"
connectionTimeout="20000"
...//省略部分内容...
:wq
[root@localhost conf]# shutdown.sh //停止服务
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 conf]# startup.sh //启动服务
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.
标签:介绍 大于 压缩 rsa 环境 add 虚拟机 ttl force
原文地址:https://blog.51cto.com/14473285/2452531