Tomcat的配置

  Tomcat的主要配置文件有3个,分别是:
    Tomcat-users.xml、
    web.xml
    server.xml。

配置Tomcat-users.xml

  该文件包含了所有Tomcat服务器的注册用户,其中有role(角色)、user(用户)两种信息。
      下面列举出这个XML文件的全部内容。

<?xml version='1.0' encoding='utf-8'?>

<!--

Licensed to the Apache Software Foundation (ASF) under one or more

contributor license agreements.  See the NOTICE file distributed with

this work for additional information regarding copyright ownership.

The ASF licenses this file to You under the Apache License, Version 2.0

(the "License"); you may not use this file except in compliance with

the License.  You may obtain a copy of the License at

以上是apache版本许可协议(感谢apache提供开源软件)

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software

distributed under the License is distributed on an "AS IS" BASIS,

WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.

See the License for the specific language governing permissions and

limitations under the License.许可证的一些信息

-->

配置部分

<tomcat-users>

<!--

NOTE:  By default, no user is included in the "manager-gui" role required

to operate the "/manager/html" web application.  If you wish to use this app,

you must define such a user - the username and password are arbitrary.

-->

<!--

NOTE:  The sample user and role entries below are wrapped in a comment

and thus are ignored when reading this file. Do not forget to remove

<!.. ..> that surrounds them.

-->

<!--

<role rolename="tomcat"/>

<role rolename="role1"/>

<user username="tomcat" password="tomcat" roles="tomcat"/>

<user username="both" password="tomcat" roles="tomcat,role1"/>

<user username="role1" password="tomcat" roles="role1"/>

-->

<role rolename="tomcat"/>

<role rolename="role1"/>

<role rolename="manager"/>

<role rolename="admin"/>

<role rolename="admin-gui"/>

<role rolename="admin-script"/>

<role rolename="manager-gui"/>

<role rolename="manager-script"/>

<role rolename="manager-jmx"/>

<role rolename="manager-status"/>

<user username="admin" password="network" roles="admin,manager,role1,tomcat,admin-gui,admin-script,manager-gui,manager-script,manager-jmx,manager-status" />

</tomcat-users>

 
 

tomcat配置tomcat-users.xml

关于tomcat的用户登录、管理配置

tomcat的管理员配置文件位置在~/conf/tomcat-users.xml

一、tomcat6管理员配置

在tomcat-users.xml添加如下代码:

<role rolename="admin"/> 
<role rolename="manager"/> 
<user username="admin" password="admin" roles="admin,manager"/> 
即可使用用户名:admin  密码:admin进行登录管理

二、tomcat7和tomcat8的管理员用户配置

tomcat7中添加了manager=gui和admin-gui角色

所以配置文件配置为:

<role rolename="manager"/> 
<role rolename="manager-gui"/> 
<role rolename="admin"/> 
<role rolename="admin-gui"/> 
<user username="admin" password="admin" roles="admin-gui,admin,manager-gui,manager"/> 

tomcat首页上的Server Status、Manager App、Host Manager即可使用admin进行登录管理

 
 
 

Tomcat 配置2 tomcat-users.xml的更多相关文章

  1. Tomcat的SSL证书配置以及Tomcat+Nginx实现SSL配置

    把jks上传到java容器在的服务器上,路径只要不是webapps下就可以,然后到conf目录下server.xml里配置 <Connector port=" protocol=&qu ...

  2. 图文解说:Nginx+tomcat配置集群负载均衡

    图文解说:Nginx+tomcat配置集群负载均衡 博客分类: appserver nginxTomcatUbuntuLinux网络应用  作者:niumd Blog:http://ari.iteye ...

  3. Nginx+tomcat配置集群负载均衡

    开发的应用采用F5负载均衡交换机,F5将请求转发给5台hp unix服务器,每台服务器有多个webserver实例,对外提供web服务和socket等接口服务.之初,曾有个小小的疑问为何不采用开源的a ...

  4. apache+tomcat配置负载均衡,实现http与websocket接口分压

    一.应用场景 在生产环境中,应用服务器(此文以tomcat为例)不免面临高访问量的压力,相比而言web服务器(此文以apache为例)能够承担更大的并发量.Apache本身带有一些模块,可以完成对应用 ...

  5. Tomcat下conf下server.xml的文件配置信息

    Tomcat下conf下server.xml的文件配置信息,基本上不用做任何修改就可以使用,修改的地方就是host区域的一些配置,此文件设置端口为80. 注意:Tomcat配置文件中(即server. ...

  6. Tomcat配置(二):tomcat配置文件server.xml详解和部署简介

    */ .hljs { display: block; overflow-x: auto; padding: 0.5em; color: #333; background: #f8f8f8; } .hl ...

  7. Tomcat配置 —— server.xml

    Tomcat的核心组件是servlet容器. Tomcat各个组件之间的嵌套关系 server.xml配置如下: <Server port="8005" shutdown=& ...

  8. 关于web.xml的welcome-file-list 配置与tomcat的关系:

    关于web.xml的welcome-file-list 配置与tomcat的关系: 2018年04月18日 10:17:13 守望dfdfdf 阅读数:377 标签: welcome-file-lis ...

  9. Tomcat 配置详解/优化方案

     转自:http://blog.csdn.net/cicada688/article/details/14451541 Service.xml Server.xml配置文件用于对整个容器进行相关的配置 ...

随机推荐

  1. STM32动态内存分配需要注意的地方

    STM32进行动态内存分配是需要注意动态内存分配大小不要超过.S文件中设置Heap Size大小 如图所示: 0x4000 :可以分配得最大字节是16384bytes 这个地方malloc的大小超过了 ...

  2. 序列积第m小元素 二分答案优化

    给出两个长度为n的数组A和B, 在A和B中各任取一个, 可以得到n×n个积. 求第m小的元素. n<=100000 这一道题的意思就是 a1 a2 a3 a4.. b1 b2 b3 b4 n^2 ...

  3. 初探ASP.NET Core 3.x (1) - 关于ASP.NET Core

    I 什么是ASP.NET Core ASP.NET is an open source web framework, created by Microsoft, for building modern ...

  4. 树形dp - 求树的直径

    随着杭州西湖的知名度的进一步提升,园林规划专家湫湫希望设计出一条新的经典观光线路,根据老板马小腾的指示,新的风景线最好能建成环形,如果没有条件建成环形,那就建的越长越好. 现在已经勘探确定了n个位置可 ...

  5. C#与JavaScript中URL编码解码问题(转)

    混乱的URI编码 JavaScript中编码有三种方法:escape.encodeURI.encodeURIComponent C#中编码主要方法:HttpUtility.UrlEncode.Serv ...

  6. SQLiteOpenHelperde的oncreate方法

    main中

  7. Error connecting to the Service Control Manager: 拒绝访问 Mongodb问题-解决

    原文地址:https://blog.csdn.net/carrot5032/article/details/74742888 发现在mongodb.log里出现  2017-07-07T17:01:5 ...

  8. Python3基础之数据类型(字典)

    Python3数据类型之 字典 字典是另一种可变容器模型,且可存储任意类型对象. 字典的每个键值(key=>value)对用冒号(:)分割,每个对之间用逗号(,)分割,整个字典包括在花括号({} ...

  9. centos7下redis安全相关

    Centos7下redis安全相关 在使用云服务器时,安装的redis3.0+版本都关闭了protected-mode,因而都遭遇了挖矿病毒的攻击,使得服务器99%的占用率!! 因此我们在使用redi ...

  10. ios--->ios == 和 isEqual的用法区别

    ios == 和 isEqual的用法区别 首先要理解指针和指针值的却别 存放变量地址的变量我们称之为"指针变量",简单的说变量p中存储的是变量a的地址,那么p就可以称为是指针变量 ...