In my last post I set up a Tomcat application server in general, now I enable Tomcat manager app for deployment.
# Tomcat Users mv /app/myApp/tomcat/conf/tomcat-users.xml /app/myApp/tomcat/conf/tomcat-users.xml_original vim /app/myApp/tomcat/conf/tomcat-users.xml vim/app/myApp/tomcat/conf/server.xml # By default the Manager is only accessible from a browser running on the same machine as Tomcat. If you wish to modify this restriction, you'll need to edit the Manager's context.xml file. vim /app/myApp/tomcat/webapps/manager/META-INF/context.xml
<?xml version="1.0" encoding="UTF-8"?> <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="manager-gui"/> <role rolename="manager-script"/> <user username="tomcat" password="tomcat" roles="manager-gui,manager-script"/> </tomcat-users>
<Server port="7010" shutdown="SHUTDOWN"> <GlobalNamingResources> <Resource name="UserDatabase" auth="Container" type="org.apache.catalina.UserDatabase" description="User database that can be updated and saved" factory="org.apache.catalina.users.MemoryUserDatabaseFactory" pathname="conf/tomcat-users.xml" /> </GlobalNamingResources> <Service name="Catalina"> <Connector port="7011" /> <!-- Define an AJP 1.3 Connector on port 7012 --> <Connector port="7012" protocol="AJP/1.3" secretRequired="false" /> <Engine name="Catalina" defaultHost="localhost" jvmRoute="myApp-dev"> <Host name="localhost" appBase="webapps" /> <Realm className="org.apache.catalina.realm.LockOutRealm"> <!-- This Realm uses the UserDatabase configured in the global JNDI resources under the key "UserDatabase". Any edits that are performed against this UserDatabase are immediately available for use by the Realm. --> <Realm className="org.apache.catalina.realm.UserDatabaseRealm" resourceName="UserDatabase"/> </Realm> </Engine> </Service> </Server>
<Context antiResourceLocking="false" privileged="true" > <!-- ## uncomment this Block ## <Valve className="org.apache.catalina.valves.RemoteAddrValve" allow="127\.\d+\.\d+\.\d+|::1|0:0:0:0:0:0:0:1" /> --> </Context>
Test Tomcat manager app
Open http://myAppServer:7011/manager and login with username: tomcat and password: tomcat.