安装Tomcat和JDK
#分别在202和203上安装JDK8和Tomcat9(JDK11bug比较多,例如jpress无法生成验证码,已在ubuntu2004和rocky8上验证都有存在问题)
[root@ubuntu2004 ~]#bash install_jdk_tomcat.sh
1) 离线安装Oracle-JDK
2) 离线安装Tomcat
3) 退出
请按要求输入操作选项:1
离线安装Oracle-JDK
请输入JDK文件名称(例如:jdk-8u333-linux-x64.tar.gz):jdk-8u341-linux-x64.tar.gz
JDK 安装完成 [ OK ]
请按要求输入操作选项:2
离线安装Tomcat
请输入Tomcat文件名称(例如:apache-tomcat-9.0.64.tar.gz):apache-tomcat-9.0.65.tar.gz
TOMCAT 安装完成 [ OK ]
请按要求输入操作选项:3
退出
[root@ubuntu2004 ~]#ss -ntlp
State Recv-Q Send-Q Local Address:Port Peer Address:Port Process
LISTEN 0 4096 127.0.0.53%lo:53 0.0.0.0:* users:(("systemd-resolve",pid=742,fd=13))
LISTEN 0 128 0.0.0.0:22 0.0.0.0:* users:(("sshd",pid=772,fd=3))
LISTEN 0 128 [::]:22 [::]:* users:(("sshd",pid=772,fd=4))
LISTEN 0 1 [::ffff:127.0.0.1]:8005 *:* users:(("java",pid=1629,fd=52))
LISTEN 0 100 *:8080 *:* users:(("java",pid=1629,fd=43))
#关闭8005端口,此处将配置文件改为-1,改为0是随机生成端口,依旧不符合安全保障,改为其他负数和删除此行会报错无法启动
[root@ubuntu2004 ~]#vim /usr/local/tomcat/conf/server.xml
<Server port="-1" shutdown="SHUTDOWN">
[root@ubuntu2004 ~]#ss -ntlp
State Recv-Q Send-Q Local Address:Port Peer Address:Port Process
LISTEN 0 4096 127.0.0.53%lo:53 0.0.0.0:* users:(("systemd-resolve",pid=742,fd=13))
LISTEN 0 128 0.0.0.0:22 0.0.0.0:* users:(("sshd",pid=772,fd=3))
LISTEN 0 128 [::]:22 [::]:* users:(("sshd",pid=772,fd=4))
LISTEN 0 100 *:8080 *:* users:(("java",pid=2140,fd=43))
Nginx反向代理配置
#安装Nginx
[root@ubuntu2004 ~]#bash install_nginx.sh
1) 编译安装nginx
2) 在线升级
3) 退出
请按要求输入操作选项:1
编译安装nginx
请输入nginx版本(例如:nginx-1.22.0):nginx-1.22.0
开始下载 nginx 源码包 [ OK ]
...
[root@ubuntu2004 ~]#mkdir /apps/nginx/conf/confd
[root@ubuntu2004 conf]#vim nginx.conf
include /apps/nginx/conf/confd/*.conf;
#自签证书
[root@ubuntu2004 ~]#mkdir /apps/nginx/certs
[root@ubuntu2004 certs]#openssl req -newkey rsa:4096 -nodes -sha256 -keyout ca.key -x509 -days 3650 -out ca.crt
Generating a RSA private key
...........................................................................................................................................++++
......................++++
writing new private key to 'ca.key'
-----
You are about to be asked to enter information that will be incorporated
into your certificate request.
What you are about to enter is what is called a Distinguished Name or a DN.
There are quite a few fields but you can leave some blank
For some fields there will be a default value,
If you enter '.', the field will be left blank.
-----
Country Name (2 letter code) [AU]:CN
State or Province Name (full name) [Some-State]:BeiJing
Locality Name (eg, city) []:BeiJing
Organization Name (eg, company) [Internet Widgits Pty Ltd]:shuhong.Ltd
Organizational Unit Name (eg, section) []:SHUHONG
Common Name (e.g. server FQDN or YOUR name) []:ca.shuhong.com
Email Address []:
[root@ubuntu2004 certs]#openssl req -newkey rsa:4096 -nodes -sha256 -keyout www.shuhong.com.key -out www.shuhong.com.csr
Generating a RSA private key
................................................................................................++++
...++++
writing new private key to 'www.shuhong.com.key'
-----
You are about to be asked to enter information that will be incorporated
into your certificate request.
What you are about to enter is what is called a Distinguished Name or a DN.
There are quite a few fields but you can leave some blank
For some fields there will be a default value,
If you enter '.', the field will be left blank.
-----
Country Name (2 letter code) [AU]:CN
State or Province Name (full name) [Some-State]:BeiJing
Locality Name (eg, city) []:BeiJing
Organization Name (eg, company) [Internet Widgits Pty Ltd]:shuhong.com
Organizational Unit Name (eg, section) []:shuhong.com
Common Name (e.g. server FQDN or YOUR name) []:www.shuhong.com
Email Address []:
Please enter the following 'extra' attributes
to be sent with your certificate request
A challenge password []:
An optional company name []:
[root@ubuntu2004 certs]#openssl x509 -req -days 3650 -in www.shuhong.com.csr -CA ca.crt -CAkey ca.key -CAcreateserial -out www.shuhong.com.crt
Signature ok
subject=C = CN, ST = BeiJing, L = BeiJing, O = shuhong.com, OU = shuhong.com, CN = www.shuhong.com
Getting CA Private Key
[root@ubuntu2004 certs]#cat www.shuhong.com.crt ca.crt > www.shuhong.com.pem
[root@ubuntu2004 certs]#vim /apps/nginx/conf/confd/www.shuhong.com.conf
upstream webservers {
server 10.0.0.202:8080;
server 10.0.0.203:8080;
}
server {
listen 80;
server_name www.shuhong.com;
return 302 https://$server_name$request_uri;
}
server {
listen 443 ssl http2;
server_name www.shuhong.com;
ssl_certificate /apps/nginx/certs/www.shuhong.com.pem;
ssl_certificate_key /apps/nginx/certs/www.shuhong.com.key;
ssl_session_cache shared:sslcache:20m;
ssl_session_timeout 10m;
location / {
proxy_pass http://webservers;
proxy_set_header Host $http_host;
}
}
[root@ubuntu2004 certs]#nginx -t
nginx: the configuration file /apps/nginx/conf/nginx.conf syntax is ok
nginx: configuration file /apps/nginx/conf/nginx.conf test is successful
[root@ubuntu2004 certs]#nginx -s reload
Tomcat应用部署(Jpress)-不支持mem的会话保持会出现验证一致错误的情况
#jpress官方网站: http://www.jpress.io/
#war包部署
[root@ubuntu2004 ~]#mkdir /data/jpress -p
[root@ubuntu2004 ~]#cd /data/jpress/
[root@ubuntu2004 jpress]#ll
总用量 69364
drwxr-xr-x 2 root root 4096 9月 23 19:57 ./
drwxr-xr-x 4 root root 4096 9月 23 19:56 ../
-rw-r--r-- 1 root root 71018586 3月 11 2022 jpress-v4.2.0.war
[root@ubuntu2004 jpress]#mv jpress-v4.2.0.war ROOT.war
[root@ubuntu2004 jpress]#ll
总用量 69368
drwxr-xr-x 2 root root 4096 9月 23 19:58 ./
drwxr-xr-x 4 root root 4096 9月 23 19:56 ../
-rw-r--r-- 1 root root 71018586 3月 11 2022 ROOT.war
[root@ubuntu2004 jpress]#vim /usr/local/tomcat/conf/server.xml
<Host name="www.shuhong.com" appBase="/data/jpress" unpackWARs="true" autoDeploy="true">
</Host>
[root@ubuntu2004 jpress]#chown -R tomcat. /data/jpress/
[root@ubuntu2004 jpress]#systemctl restart tomcat.service
[root@ubuntu2004 jpress]#ll
总用量 69372
drwxr-xr-x 3 tomcat tomcat 4096 9月 23 20:01 ./
drwxr-xr-x 4 root root 4096 9月 23 19:56 ../
drwxr-x--- 6 tomcat tomcat 4096 9月 23 20:01 ROOT/
-rw-r--r-- 1 tomcat tomcat 71018586 3月 11 2022 ROOT.war
#202和203同样执行以上全部操作
#安装数据库206
[root@ubuntu2004 ~]#apt -y install mysql-server
[root@ubuntu2004 ~]#mysql
mysql> create database jpress;
Query OK, 1 row affected (0.01 sec)
mysql> create user jpress@'10.0.0.%' identified by '123456';
Query OK, 0 rows affected (0.01 sec)
mysql> grant all on jpress.* to jpress@'10.0.0.%';
Query OK, 0 rows affected (0.01 sec)
[root@ubuntu2004 ~]#vim /etc/mysql/mysql.conf.d/mysqld.cnf
[mysqld]
default_authentication_plugin=mysql_native_password
#bind-address = 127.0.0.1
#mysqlx-bind-address = 127.0.0.1
[root@ubuntu2004 ~]#systemctl restart mysql.service
Nginx负载均衡加代理(无需加8080端口号)
Nginx实现https加密
Tomcat应用部署(halo)
#halo官网: https://halo.run/
[root@ubuntu2004 ~]#mkdir /data/halo
#docker部署
docker run -it -d --name halo -p 8090:8090 -v ~/.halo:/root/.halo --restart=always halohub/halo
#jar包部署
java -jar /apps/halo.jar --server.port=80
Memcache(sticky)
#安装配置Memcache
[root@ubuntu2004 ~]#apt -y install memcached
[root@ubuntu2004 ~]#vim /etc/memcached.conf
-m 1024
-l 0.0.0.0
[root@ubuntu2004 ~]#systemctl restart memcached.service
[root@ubuntu2004 ~]#ss -ntlp
State Recv-Q Send-Q Local Address:Port Peer Address:Port Process
LISTEN 0 1024 0.0.0.0:11211 0.0.0.0:* users:(("memcached",pid=5347,fd=26))
LISTEN 0 4096 127.0.0.53%lo:53 0.0.0.0:* users:(("systemd-resolve",pid=740,fd=13))
LISTEN 0 128 0.0.0.0:22 0.0.0.0:* users:(("sshd",pid=773,fd=3))
LISTEN 0 128 [::]:22 [::]:* users:(("sshd",pid=773,fd=4))
#配置Tomcat服务器202
[root@ubuntu2004 ~]#vim /usr/local/tomcat/conf/context.xml
<Manager className="de.javakaffee.web.msm.MemcachedBackupSessionManager"
memcachedNodes="n1:10.0.0.204:11211,n2:10.0.0.205:11211"
failoverNodes="n1"
requestUriIgnorePattern=".*\.(ico|png|gif|jpg|css|js)$"
transcoderFactoryClass="de.javakaffee.web.msm.serializer.kryo.KryoTranscoderFactory"/>
#配置Tomcat服务器203
[root@ubuntu2004 ~]#vim /usr/local/tomcat/conf/context.xml
<Manager className="de.javakaffee.web.msm.MemcachedBackupSessionManager"
memcachedNodes="n1:10.0.0.204:11211,n2:10.0.0.205:11211"
failoverNodes="n2"
requestUriIgnorePattern=".*\.(ico|png|gif|jpg|css|js)$"
transcoderFactoryClass="de.javakaffee.web.msm.serializer.kryo.KryoTranscoderFactory"/>
#将相关包传到lib/目录下,共10个文件
[root@ubuntu2004 lib]#ll
总用量 11688
drwxr-x--- 2 tomcat tomcat 4096 9月 24 09:40 ./
drwxr-xr-x 9 tomcat tomcat 4096 9月 24 09:21 ../
-rw-r----- 1 tomcat tomcat 13197 7月 14 20:28 annotations-api.jar
-rw-r----- 1 tomcat tomcat 54047 7月 14 20:28 catalina-ant.jar
-rw-r----- 1 tomcat tomcat 123877 7月 14 20:28 catalina-ha.jar
-rw-r----- 1 tomcat tomcat 1725027 7月 14 20:28 catalina.jar
-rw-r----- 1 tomcat tomcat 62798 7月 14 20:28 catalina-ssi.jar
-rw-r----- 1 tomcat tomcat 78048 7月 14 20:28 catalina-storeconfig.jar
-rw-r----- 1 tomcat tomcat 337038 7月 14 20:28 catalina-tribes.jar
-rw-r----- 1 tomcat tomcat 3133846 7月 14 20:28 ecj-4.20.jar
-rw-r----- 1 tomcat tomcat 88938 7月 14 20:28 el-api.jar
-rw-r----- 1 tomcat tomcat 171510 7月 14 20:28 jasper-el.jar
-rw-r----- 1 tomcat tomcat 567260 7月 14 20:28 jasper.jar
-rw-r----- 1 tomcat tomcat 27125 7月 14 20:28 jaspic-api.jar
-rw-r----- 1 tomcat tomcat 63545 7月 14 20:28 jsp-api.jar
-rw-r----- 1 tomcat tomcat 284303 7月 14 20:28 servlet-api.jar
-rw-r----- 1 tomcat tomcat 11516 7月 14 20:28 tomcat-api.jar
-rw-r----- 1 tomcat tomcat 924799 7月 14 20:28 tomcat-coyote.jar
-rw-r----- 1 tomcat tomcat 342429 7月 14 20:28 tomcat-dbcp.jar
-rw-r----- 1 tomcat tomcat 69607 7月 14 20:28 tomcat-i18n-cs.jar
-rw-r----- 1 tomcat tomcat 77871 7月 14 20:28 tomcat-i18n-de.jar
-rw-r----- 1 tomcat tomcat 105207 7月 14 20:28 tomcat-i18n-es.jar
-rw-r----- 1 tomcat tomcat 167943 7月 14 20:28 tomcat-i18n-fr.jar
-rw-r----- 1 tomcat tomcat 190756 7月 14 20:28 tomcat-i18n-ja.jar
-rw-r----- 1 tomcat tomcat 191224 7月 14 20:28 tomcat-i18n-ko.jar
-rw-r----- 1 tomcat tomcat 52935 7月 14 20:28 tomcat-i18n-pt-BR.jar
-rw-r----- 1 tomcat tomcat 50259 7月 14 20:28 tomcat-i18n-ru.jar
-rw-r----- 1 tomcat tomcat 174375 7月 14 20:28 tomcat-i18n-zh-CN.jar
-rw-r----- 1 tomcat tomcat 149546 7月 14 20:28 tomcat-jdbc.jar
-rw-r----- 1 tomcat tomcat 37872 7月 14 20:28 tomcat-jni.jar
-rw-r----- 1 tomcat tomcat 215612 7月 14 20:28 tomcat-util.jar
-rw-r----- 1 tomcat tomcat 224215 7月 14 20:28 tomcat-util-scan.jar
-rw-r----- 1 tomcat tomcat 241607 7月 14 20:28 tomcat-websocket.jar
-rw-r----- 1 tomcat tomcat 39977 7月 14 20:28 websocket-api.jar
-rw-r--r-- 1 root root 10967 6月 25 2021 memcached-session-manager-tc9-2.3.2.jar
-rw-r--r-- 1 root root 53259 8月 22 2020 asm-5.2.jar
-rw-r--r-- 1 root root 126366 8月 22 2020 kryo-serializers-0.45.jar
-rw-r--r-- 1 root root 38372 8月 22 2020 msm-kryo-serializer-2.3.2.jar
-rw-r--r-- 1 root root 285211 8月 22 2020 kryo-3.0.3.jar
-rw-r--r-- 1 root root 5923 8月 22 2020 minlog-1.3.1.jar
-rw-r--r-- 1 root root 55684 8月 22 2020 objenesis-2.6.jar
-rw-r--r-- 1 root root 72265 8月 22 2020 reflectasm-1.11.9.jar
-rw-r--r-- 1 root root 586620 8月 22 2020 jedis-3.0.0.jar
-rw-r--r-- 1 root root 167294 8月 22 2020 memcached-session-manager-2.3.2.jar
-rw-r--r-- 1 root root 473774 8月 22 2020 spymemcached-2.12.3.jar
#测试python
[root@ubuntu2004 ~]#cat showmemcached.py
#!/usr/bin/python3
import memcache # pip install python-memcached
mc = memcache.Client(['10.0.0.204:11211','10.0.0.205:11211'], debug=True)
#print('-' * 30)
# 查看全部key
for x in mc.get_stats('items'): # stats items 返回 items:5:number 1
print(x)
print('-' * 30)
for x in mc.get_stats('cachedump 5 0'):
print(x)
[root@ubuntu2004 ~]#python3 showmemcached.py
MemCached: MemCache: inet:10.0.0.205:11211: connect: [Errno 111] Connection refused. Marking dead.
('10.0.0.204:11211 (1)', {'items:5:number': '1', 'items:5:number_hot': '0', 'items:5:number_warm': '0', 'items:5:number_cold': '1', 'items:5:age_hot': '0', 'items:5:agem': '0', 'items:5:age': '3', 'items:5:mem_requested': '198', 'items:5:evicted': '0', 'items:5:evicted_nonzero': '0', 'items:5:evicted_time': '0', 'items:5:outofmemory':, 'items:5:tailrepairs': '0', 'items:5:reclaimed': '0', 'items:5:expired_unfetched': '0', 'items:5:evicted_unfetched': '0', 'items:5:evicted_active': '0', 'items:5:crawreclaimed': '0', 'items:5:crawler_items_checked': '0', 'items:5:lrutail_reflocked': '0', 'items:5:moves_to_cold': '1', 'items:5:moves_to_warm': '0', 'items:5:moves_withru': '0', 'items:5:direct_reclaims': '0', 'items:5:hits_to_hot': '0', 'items:5:hits_to_warm': '0', 'items:5:hits_to_cold': '0', 'items:5:hits_to_temp': '0'})
------------------------------
('10.0.0.204:11211 (1)', {'802528A33930CEC41200B954A1C2593F-n1': '[104 b; 1663988412 s]'})
Memcache(non-sticky)
#和sticky区别在配置文件content.xml
<Manager className="de.javakaffee.web.msm.MemcachedBackupSessionManager"
memcachedNodes="n1:10.0.0.204:11211,n2:10.0.0.205:11211"
sticky="false"
sessionBackupAsync="false"
lockingMode="uriPattern:/path1|/path2"
requestUriIgnorePattern=".*\.(ico|png|gif|jpg|css|js)$"
transcoderFactoryClass="de.javakaffee.web.msm.serializer.kryo.KryoTranscoderFactory"/>
</Context>
#测试
[root@ubuntu2004 ~]#python3 showmemcached.py
('10.0.0.204:11211 (1)', {'items:3:number': '8', 'items:3:number_hot': '1', 'items:3:number_warm': '0', 'items:3:number_cold': '7', 'items:3:age_hot': '2', 'items:3:age_warm': '0', 'items:3:age': '40', 'items:3:mem_requested': '1004', 'items:3:evicted': '0', 'items:3:evicted_nonzero': '0', 'items:3:evicted_time': '0', 'items:3:outofmemory': '0', 'items:3:tailrepairs': '0', 'items:3:reclaimed': '0', 'items:3:expired_unfetched': '0', 'items:3:evicted_unfetched': '0', 'items:3:evicted_active': '0', 'items:3:crawler_reclaimed': '0', 'items:3:crawler_items_checked': '8', 'items:3:lrutail_reflocked': '0', 'items:3:moves_to_cold': '8', 'items:3:moves_to_warm': '0', 'items:3:moves_within_lru': '0', 'items:3:direct_reclaims': '0', 'items:3:hits_to_hot': '15', 'items:3:hits_to_warm': '0', 'items:3:hits_to_cold': '1', 'items:3:hits_to_temp': '0', 'items:5:number': '8', 'items:5:number_hot': '1', 'items:5:number_warm': '1', 'items:5:number_cold': '6', 'items:5:age_hot': '2', 'items:5:age_warm': '32', 'items:5:age': '40', 'items:5:mem_requested': '1626', 'items:5:evicted': '0', 'items:5:evicted_nonzero': '0', 'items:5:evicted_time': '0', 'items:5:outofmemory': '0', 'items:5:tailrepairs': '0', 'items:5:reclaimed': '0', 'items:5:expired_unfetched': '0', 'items:5:evicted_unfetched': '0', 'items:5:evicted_active': '0', 'items:5:crawler_reclaimed': '0', 'items:5:crawler_items_checked': '8', 'items:5:lrutail_reflocked': '1', 'items:5:moves_to_cold': '7', 'items:5:moves_to_warm': '1', 'items:5:moves_within_lru': '13', 'items:5:direct_reclaims': '0', 'items:5:hits_to_hot': '1', 'items:5:hits_to_warm': '13', 'items:5:hits_to_cold': '2', 'items:5:hits_to_temp': '0'})
('10.0.0.205:11211 (1)', {'items:3:number': '8', 'items:3:number_hot': '1', 'items:3:number_warm': '0', 'items:3:number_cold': '7', 'items:3:age_hot': '3', 'items:3:age_warm': '0', 'items:3:age': '41', 'items:3:mem_requested': '996', 'items:3:evicted': '0', 'items:3:evicted_nonzero': '0', 'items:3:evicted_time': '0', 'items:3:outofmemory': '0', 'items:3:tailrepairs': '0', 'items:3:reclaimed': '0', 'items:3:expired_unfetched': '0', 'items:3:evicted_unfetched': '0', 'items:3:evicted_active': '0', 'items:3:crawler_reclaimed': '0', 'items:3:crawler_items_checked': '8', 'items:3:lrutail_reflocked': '0', 'items:3:moves_to_cold': '7', 'items:3:moves_to_warm': '0', 'items:3:moves_within_lru': '0', 'items:3:direct_reclaims': '0', 'items:3:hits_to_hot': '4', 'items:3:hits_to_warm': '0', 'items:3:hits_to_cold': '0', 'items:3:hits_to_temp': '0', 'items:5:number': '8', 'items:5:number_hot': '0', 'items:5:number_warm': '1', 'items:5:number_cold': '7', 'items:5:age_hot': '0', 'items:5:age_warm': '3', 'items:5:age': '41', 'items:5:mem_requested': '1618', 'items:5:evicted': '0', 'items:5:evicted_nonzero': '0', 'items:5:evicted_time': '0', 'items:5:outofmemory': '0', 'items:5:tailrepairs': '0', 'items:5:reclaimed': '0', 'items:5:expired_unfetched': '0', 'items:5:evicted_unfetched': '0', 'items:5:evicted_active': '0', 'items:5:crawler_reclaimed': '0', 'items:5:crawler_items_checked': '8', 'items:5:lrutail_reflocked': '0', 'items:5:moves_to_cold': '7', 'items:5:moves_to_warm': '1', 'items:5:moves_within_lru': '1', 'items:5:direct_reclaims': '0', 'items:5:hits_to_hot': '3', 'items:5:hits_to_warm': '1', 'items:5:hits_to_cold': '0', 'items:5:hits_to_temp': '0'})
------------------------------
('10.0.0.204:11211 (1)', {'bak:A885B4DA8BE7610DF843BAB1EF6392F1-n2': '[104 b; 1663990876 s]', 'bak:9A42C361B7A5FBA4919F37C74989EEBB-n2': '[104 b; 1663990875 s]', 'bak:2ADBB5887E5FB3FBC3CC402C2AC1E859-n2': '[104 b; 1663990875 s]', 'bak:56F35BB3C99CDC55D97A5BADCB862847-n2': '[104 b; 1663990875 s]', '9E8F7C669EE27282A5CB7467AB96E3AB-n1': '[104 b; 1663990874 s]', '2EF5C88413306B300D36DD3D26697B0F-n1': '[104 b; 1663990873 s]'})
('10.0.0.205:11211 (1)', {'bak:DAA9577AD2517F24AD2AA78E0C8F2EBB-n1': '[115 b; 1663990876 s]', 'A885B4DA8BE7610DF843BAB1EF6392F1-n2': '[104 b; 1663990875 s]', '9A42C361B7A5FBA4919F37C74989EEBB-n2': '[104 b; 1663990875 s]', '2ADBB5887E5FB3FBC3CC402C2AC1E859-n2': '[104 b; 1663990874 s]', '56F35BB3C99CDC55D97A5BADCB862847-n2': '[104 b; 1663990874 s]', 'bak:9E8F7C669EE27282A5CB7467AB96E3AB-n1': '[104 b; 1663990874 s]', 'bak:2EF5C88413306B300D36DD3D26697B0F-n1': '[104 b; 1663990872 s]'})
Redis
[root@ubuntu2004 ~]#apt -y install redis
#配置tomcat服务器
[root@ubuntu2004 ROOT]#vim /usr/local/tomcat/conf/context.xml
<Manager className="de.javakaffee.web.msm.MemcachedBackupSessionManager"
memcachedNodes="redis://10.0.0.206"
sticky="false"
sessionBackupAsync="false"
lockingMode="uriPattern:/path1|/path2"
requestUriIgnorePattern=".*\.(ico|png|gif|jpg|css|js)$"
transcoderFactoryClass="de.javakaffee.web.msm.serializer.kryo.KryoTranscoderFactory"/>
#测试
[root@ubuntu2004 ~]#redis-cli
127.0.0.1:6379> KEYS *
1) "D4497F68CF29AA824D22B22F89CFC3C5"
2) "validity:17E4EB35D994215A4523C63A57698CFF"
3) "CA35C49118E893BC575924AE8025799B"
4) "validity:66F6CA78650BD580C7E6369B78C1F0E2"
5) "66F6CA78650BD580C7E6369B78C1F0E2"
6) "validity:D4497F68CF29AA824D22B22F89CFC3C5"
7) "validity:CA35C49118E893BC575924AE8025799B"
8) "17E4EB35D994215A4523C63A57698CFF"
127.0.0.1:6379> KEYS *
1) "1940AB981FE5530DE1FB8F94D80E1E70"
2) "CA35C49118E893BC575924AE8025799B"
3) "validity:1940AB981FE5530DE1FB8F94D80E1E70"
4) "validity:CA35C49118E893BC575924AE8025799B"
5) "D4497F68CF29AA824D22B22F89CFC3C5"
6) "validity:17E4EB35D994215A4523C63A57698CFF"
7) "66F6CA78650BD580C7E6369B78C1F0E2"
8) "validity:66F6CA78650BD580C7E6369B78C1F0E2"
9) "validity:D4497F68CF29AA824D22B22F89CFC3C5"
10) "17E4EB35D994215A4523C63A57698CFF"
127.0.0.1:6379>
开启tomcat管理页面
[root@ubuntu2004 conf]#vim tomcat-users.xml
...
<tomcat-users xmlns="http://tomcat.apache.org/xml"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://tomcat.apache.org/xml tomcat-users.xsd"
version="1.0">
<role rolename="manager-gui"/>
<role rolename="admin-gui" />
<user username="tomcat" password="tomcat" roles="manager-gui,admin-gui"/>
...
#基于web方式应用server status 和 manager app
[root@ubuntu2004 conf]#vim ../webapps/manager/META-INF/context.xml
allow="127\.\d+\.\d+\.\d+|::1|0:0:0:0:0:0:0:1|10\.0\.0\.\d+" />
[root@ubuntu2004 conf]#systemctl restart tomcat.service
#基于web方式的Host Manager虚拟主机管理
[root@ubuntu2004 conf]#vim ../webapps/host-manager/META-INF/context.xml
allow="127\.\d+\.\d+\.\d+|::1|0:0:0:0:0:0:0:1|10\.0\.0\.\d+" />
[root@ubuntu2004 conf]#systemctl restart tomcat.service