tomcat配置文件server.xml
<Host name="www.test.org" appBase="/code/tomcat/"
unpackWARs="true" autoDeploy="true">
<Context docBase="/code/zh" path="/zh" reloadable="true"/>
<Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs"
prefix="test_access_log" suffix=".txt"
pattern="%h %l %u %t "%r" %s %b" />
</Host>
- Context:相当于nginx 的 location 匹配规则
重启服务
[root@nginx tomcat]# systemctl stop tomcat.service
[root@nginx tomcat]# systemctl start tomcat.service
[root@nginx tomcat]# mkdir /code/tomcat/ROOT
[root@nginx tomcat]# echo "test" >> /code/tomcat/ROOT/index.html
[root@nginx tomcat]# echo "zh" >> /code/zh/index.html
## tomcat如果配置错误,没有报错信息,需要看日志
[root@nginx tomcat]# tailf /soft/tomcat/logs/catalina.out