1、第一个tomcat。使用tomcat默认的8080
(1)
<Server port="8005" shutdown="SHUTDOWN">
(2)
<Connector port="8080" protocol="HTTP/1.1" connectionTimeout="20000" redirectPort="8443" />
其他的端口可以全部注释
2、第二个tomcat。使用https并用端口80
(1)因为第一个tomcat “SHUTDOWN”使用了8005,,所以必须修改server port
<Server port="8006" shutdown="SHUTDOWN">
(2)端口修改成80,并使用https协议
<Connector port="80" protocol="HTTP/1.1" connectionTimeout="20000" redirectPort="443" /> <Connector port="443" protocol="HTTP/1.1" SSLEnabled="true" maxThreads="150" scheme="https" secure="true" clientAuth="want" sslProtocol="TLS" keystoreFile="Tomcat.keystore" keystorePass="12345" truststoreFile="Tomcat.keystore" truststorePass="12345" />
3、修改tomcat虚拟目录
<Host name="localhost" appBase="webapps" unpackWARs="true" autoDeploy="true" xmlValidation="false" xmlNamespaceAware="false"> <Context path="" docBase="/home/nange/webapp/webProject" debug="0" reloadable="true"/> </Host>
Context 其中path为虚拟目录,也就是服务器IP地址之后的目录(比如你想让访问者输入http://IP地址:8080/AAA/就能访问这个项目,那么path就要设置为path="/AAA",如果想让用户输入http://IP地址:8080/就能访问,那么path就设为path="")
docBase为绝对目录,默认路径为tomcat下头的webapps。(例如我的新项目ele放在webapps下头,我就需要把docBase设为docBase="/ele")