一、修改默认主页
1.修改 tomcat 配置文件 server.xml
-
打开tomcat 的 server.xml 文件
-
-
编辑 server.xml , 找到166 row , add <Context path="" docBase="/app/apache-tomcat-9.0.31/webapps/ROOT"/>
2. 修改默认页面
-
创建文件名为
ROOT 放在
/app/apache-tomcat-9.0.31/webapps/ 并且创建index.html
cd /app/apache-tomcat-9.0.31/webapps
mkdir ROOT
cd ROOT
touch index.html
vim index.html
-
编辑 index.html
<html>
<head>
<title>xxxxxxxxx</title>
</head>
<body >
<meta http-equiv="refresh" content="0; URL='xxxxxxxx'" />
</body>
</html>
二、配置http协议
生成 p12 证书
//将 /.pem 转换成 /.p12 openssl pkcs12 -export -in cert.pem -inkey cert.key -out keystore.p12
// 将 /.p12 转成 /.jks keytool -importkeystore -srckeystore keystore.p12 -srcstoretype PKCS12 -destkeystore keystore.jks
1.创建文件名为 ssl ,将后缀为 .jks 放入 ssl 文件
2.编辑 server.xml
<Connector 2 protocol="org.apache.coyote.http11.Http11NioProtocol" 3 port="8443" maxThreads="200" 4 scheme="https" secure="true" SSLEnabled="true" 5 keystoreFile="/app/apache-tomcat-9.0.31/conf/ssl/keystore.jks" keystorePass="xxxxx" 6 clientAuth="false" sslProtocol="TLS"/>
三、开启双协议访问
将监听 8080 端口改成 80
将监听 8443 端口改成 443