Apache Tomcat:多个网络应用程序 [英] Apache Tomcat: multiple webapps

查看:42
本文介绍了Apache Tomcat:多个网络应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 Apache Tomcat 开发 Web 应用程序.此 webapp 将部署在托管其他 webapp 的服务器中.现在,由于我的 webapp 需要用户进行身份验证,我需要修改 Tomcat 的conf"目录中的一些文件,例如tomcat-users.xml".问题是这些文件与其他 web 应用程序共享.有没有办法为我的 webapp 设置一个与共享目录分开的conf"目录?谢谢你.

I'm developing a webapp using Apache Tomcat. This webapp will be deployed in a server which hosts other webapps. Now, since my webapp requires the user to authenticate, I'd need to modify some files in the "conf" directory of Tomcat such as "tomcat-users.xml". The problem is that these files are shared with the other webapps. Is there a way to have a "conf" directory for my webapp which is separated from the shared one? Thank you.

推荐答案

Tomcat 允许您通过在 $CATALINA_BASE/conf/[enginename]/[hostname] 下创建一个 xml 文件,从主 server.xml 中分离出配置> 称为 [YourWebappName].xml.

Tomcat allows you to separate out configuration from the main server.xml by creating an xml file underneath $CATALINA_BASE/conf/[enginename]/[hostname] called [YourWebappName].xml.

例如:$CATALINA_BASE/conf/Catalina/localhost/PetClinic.xml

这个文件基本上包含一个 元素,用于定义 webapp 特定的上下文配置.在这里,您可以使用应用所需的身份验证参数.

This file bascially contains a <Context> element defining the webapp specific context configuration. In here you can define your own webapp specific realm with the necessary authentication parameters for your app.

此机制旨在让您可以修改 webapp 特定配置,而无需触及 Tomcat 的 conf 文件夹中的顶级共享文件.

This mechanism is designed so that you can modify webapp specific configuration without touching the top-level shared files in Tomcat's conf folder.

这篇关于Apache Tomcat:多个网络应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆