Tomcat性能优化
一、安装Centos01上安装tomcat发布动态网站jpress使用www.Benet.com访问,配置虚拟机主机通过www.benet.com和www.accp.com访问不同的虚拟主机
1)上传tomcat文件包
[root@centos01 ~]# rz
[root@centos01 ~]# ls
anaconda-ks.cfg 公共 图片 音乐
apache-tomcat-8.5.50.tar.gz 模板 文档 桌面
initial-setup-ks.cfg 视频 下载
2)解压移动tomcat
[root@centos01 ~]# tar zxf ./apache-tomcat-8.5.50.tar.gz -C /usr/src/
[root@centos01 ~]# mv /usr/src/apache-tomcat-8.5.50/ /usr/local/tomcat
3)启动tomcat监听进程
[root@centos01 ~]#/usr/local/tomcat/bin/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
Using CLASSPATH:
/usr/local/tomcat/bin/bootstrap.jar:/usr/local/tomcat/bin/tomcat-juli.jar
Tomcat started.
[root@centos01 ~]# netstat -anptu | grep java
tcp6
0 0 :::8080 :::* LISTEN 1238/java
tcp6
0 0 127.0.0.1:8005 :::* LISTEN 1238/java
tcp6
0 0 :::8009 :::* LISTEN 1238/java
4)客户端验证
5)安装动态网站
[root@centos01 ~]#/usr/local/tomcat/bin/shutdown.sh
[root@centos01 ~]# cd /usr/local/tomcat/webapps/
[root@centos01 webapps]# ls
docs
host-manager jpress.war ROOT
examples
jpress manager
6)安装jpress数据库
[root@centos01 webapps]# mount /dev/cdrom /mnt/
mount: /dev/sr0 写保护,将以只读方式挂载
[root@centos01 webapps]# rm -rf /etc/yum.repos.d/CentOS-*
[root@centos01 webapps]# yum -y install mariadb mariadb-server
7)启动服务设置开机自动启动
[root@centos01 ~]# systemctl start mariadb
[root@centos01 ~]# systemctl enable mariadb
8)设置用户和密码
[root@centos01 ~]# mysqladmin -uroot password
[root@centos01 ~]# mysql -uroot -ppwd@123
9)创建数据库用户访问
MariaDB [(none)]> create database jpress charset utf8;
10)授权用户访问
MariaDB [(none)]> grant all on jpress.* to 'bbs'@'localhost' identified by 'pwd@123';
11)创建数据库
12)登录进去查看动态网站
二、Centos02安装DNS域名解析www.benet.com www.accp.com www.bdqn.com访问网站
1、安装DNS
1)挂载光盘安装DNS
[root@centos02 ~]# mount /dev/cdrom /mnt/
mount: /dev/sr0 写保护,将以只读方式挂载
[root@centos02 ~]# rpm -ivh
/mnt/Packages/bind-9.9.4-50.el7.x86_64.rpm
[root@centos02 ~]# rpm -ivh
/mnt/Packages/bind-chroot-9.9.4-50.el7.x86_64.rpm
2)修改DNS服务主配置文件
[root@centos02 ~]# vim /etc/named.conf
options {
listen-on port 53 { any; };
directory "/var/named";
};
zone "accp.com" IN {
type master;
file "/var/named/accp.com.zone";
};
zone "bdqn.com" IN {
type master;
file "/var/named/bdqn.com.zone";
};
zone "benet.com" IN {
type master;
file "/var/named/benet.com.zone";
};
3)修改DNS区域配置文件
[root@centos02 ~]# vim /var/named/benet.com.zone
$TTL 86400
@ SOA benet.com. root.benet.com.
(
2023031415
1H
15M
1W
1D
)
@ NS centos02.benet.com.
centos02 A 192.168.100.20
www A 192.168.100.10
[root@centos02 ~]# vim
/var/named/accp.com.zone
$TTL 86400
@ SOA accp.com. root.accp.com.
(
2023031415
1H
15M
1W
1D
)
@ NS centos02.accp.com.
centos02 A 192.168.100.20
www A 192.168.100.10
[root@centos02 ~]# vim
/var/named/bdqn.com.zone
$TTL 86400
@ SOA bdqn.com. root.bdqn.com.
(
2023031415
1H
15M
1W
1D
)
@ NS centos02.bdqn.com.
centos02 A 192.168.100.20
www A 192.168.100.10
4)启动服务
[root@centos02 ~]# systemctl start named
[root@centos02 ~]# systemctl enable named
5)客户端解析域名
6)客户端验证域名访问tomcat
标签:tomcat,一步,centos01,centos02,优化,com,root,usr From: https://blog.51cto.com/u_15946809/6120613