宝塔Java项目访问密码

作者 :
免费
  • 正文
  • 1、路径/www/server/bt_tomcat_web/网站项目/conf/tomcat-users.xml

    <tomcat-users xmlns="http://tomcat.apache.org/xml"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://tomcat.apache.org/xml tomcat-users.xsd"
    version="1.0">

    <role rolename="user"/>

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

    </tomcat-users>

    角色user 用户名admin  密码admin

    2、网站项目/WEB-INF/web.xml ,添加如下代码:

    <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" id="WebApp_ID" version="3.0">

    <security-constraint>
    <web-resource-collection>
    <web-resource-name>force login</web-resource-name>
    <!-- Define the context-relative URL(s) to be protected -->
    <url-pattern>/*</url-pattern>
    <!-- If you list http methods, only those methods are protected -->
    </web-resource-collection>
    <auth-constraint>
    <!-- Anyone with one of the listed roles may access this area -->
    <role-name>user</role-name>
    </auth-constraint>
    </security-constraint>
    <login-config>
    <auth-method>BASIC</auth-method>
    <realm-name>force login</realm-name>
    </login-config>
    <!-- Security roles referenced by this web application -->
    <security-role>
    <role-name>user</role-name>
    </security-role>

    </web-app>

    宝塔Java项目访问密码-完美源码

    END
    如本资源侵犯了您的权益,请联系投诉邮箱admin@wmphp.com进行举报!我们将在收到邮件的1个小时内处理完毕。 本站仅为平台,发布的资源均为用户投稿或转载!所有资源仅供参考学习使用,请在下载后的24小时内删除,禁止商用! Wmphp.com(完美源码)助力正版,如您有自己的原创产品,可以联系客服投稿,代理出售! Wmphp.com(完美源码)客服QQ:136882447 Wmphp.com(完美源码)商务电话(仅对企业客户/个人用户):15120086569 (微信同步) 请注意:本站不提供任何免费的技术咨询服务,为了节约时间,下载前 请确认自己会技术
    完美源码 » 宝塔Java项目访问密码
    3494+

    本站勉强运行

    3673+

    用户总数

    690+

    资源总数

    0+

    今日更新

    2024-4-8

    最后更新时间