Tomcat Access Control

Tomcat Access Control

Note: The test function, do not use the production environment
  tomcat tomcat management functions for itself and applications deployed on tomcat will be web application management.
Default is disabled, and if necessary turn on this feature, you need to configure user management, namely configuration,
Tomcat-users.xml file.
~~~~~~~~ following experiments: Host: 192.168.200.67
[the root @ localhost ~] # Java -version
OpenJDK Version "1.8.0_131"
the OpenJDK the Runtime Environment (Build 1.8.0_131-B12)
the OpenJDK the VM 64-Bit Server (Build-B12 25.131, Mixed MODE)
[the root @ localhost ~] # the tar-XF Apache Tomcat-8.5.40.tar.gz
[the root @ localhost ~] # LS
Anaconda-public Download the ks.cfg
apache-tomcat-8.5. 40 template music
apache-tomcat-8.5.40.tar.gz video Desktop
initial-setup-ks.cfg picture
original-ks.cfg file
[root @ localhost ~] # mv apache-tomcat-8.5.40 / usr / local / tomcat8
[root@localhost ~]# /usr/local/tomcat8/bin/startup.sh
[root@localhost ~]# tail -f /usr/local/tomcat8/logs/catalina.2019-11-20.log

Access 192.168.200.67:8080 in your browser

·················································· ·······················
[1] click on the page server status will be 403 pages, for the following reasons: verify the user name and password are authorized to address two restrictions a.
Solutions are as follows:
[the root @ localhost ~] Vim /usr/local/tomcat8/conf/tomcat-users.xml #
  44 is <Role rolename = "GUI-Manager" />
 45 <Role rolrname = "ADMIN-GUI" />
 46 <user username = "tomcat" password = "tomcat" r oles = "manager-gui, admin-gui" />
save and exit
/////// modifying the address file ///////
[the root @ localhost ~] # vim /usr/local/tomcat8/webapps/manager/META-INF/context.xml // comments following
 19 <-! <Valve className = "org.apache.catalina.valves .RemoteAddrValve"
 20 the allow = "... 127 \ \ d + \ \ d + \ \ d + | :: 1 | 0: 0: 0: 0: 0: 0: 0: 1" /> ->


[root @ localhost ~] # /usr/local/tomcat8/bin/startup.sh
[root @ localhost ~] # tail -f /usr/local/tomcat8/logs/catalina.2019-11-23.log
browser click the access 192.168.200.67:8080 server status page will prompt you to enter a user name and password tomcat tomcat password then you can visit

 

 

 

 

 

 

 This feature is recommended on the test machine is not recommended on production servers, so that users know Sensitive Information

 

 

 

 

 

 

 

 

 

Guess you like

Origin www.cnblogs.com/elin989898/p/11919562.html