tomcat 远程部署
tomcat 的管理功能非常强,只要你配置好了tomcat-user.xml.
主要是增加一个 具有系统管理权限的用户,比如增加一个用户名和密码都是admin的用户,只需要在在最后一行增加
<role rolename="tomcat"/> <role rolename="role1"/> <role rolename="manager"/> <role rolename="admin"/> <user username="tomcat" password="tomcat" roles="tomcat"/> <user username="both" password="tomcat" roles="tomcat,role1"/> <user username="role1" password="tomcat" roles="role1"/> <user username="admin" password="admin" roles="admin,manager"/>
http://{ host }:{ port }/manager/{ command }?{ parameters }http://localhost:8080/manager/deploy?path=/foohttp://localhost:8080/manager/deploy?path=/foo http://localhost:8080/man......o&war=file:/path/to/foo http://localhost:8080/manager/deploy?war=foo http://localhost:8080/man......ath=/bartoo&war=bar.war
http://localhost:8080/manager/list
http://localhost:8080/manager/reload?path=/examples
http://localhost:8080/manager/serverinfo
http://localhost:8080/manager/roles
http://localhost:8080/manager/sessions?path=/examples
http://localhost:8080/manager/start?path=/examples
http://localhost:8080/manager/stop?path=/examples
<project name="My Application" default="compile" basedir="."> <!-- Configure the directory into which the web application is built --> <property name="build" value="${ basedir }/build"/> <!-- Configure the context path for this application --> <property name="path" value="/myapp"/> <!-- Configure properties to access the Manager application --> <property name="url" value="http://localhost:8080/manager"/> <property name="username" value="myusername"/> <property name="password" value="mypassword"/> <!-- Configure the custom Ant tasks for the Manager application --> <taskdef name="deploy" classname="org.apache.catalina.ant.DeployTask"/> <taskdef name="list" classname="org.apache.catalina.ant.ListTask"/> <taskdef name="reload" classname="org.apache.catalina.ant.ReloadTask"/> <taskdef name="resources" classname="org.apache.catalina.ant.ResourcesTask"/> <taskdef name="roles" classname="org.apache.catalina.ant.RolesTask"/> <taskdef name="start" classname="org.apache.catalina.ant.StartTask"/> <taskdef name="stop" classname="org.apache.catalina.ant.StopTask"/> <taskdef name="undeploy" classname="org.apache.catalina.ant.UndeployTask"/> <!-- Executable Targets --> <target name="compile" description="Compile web application"> <!-- ... construct web application in ${ build } subdirectory, and generated a ${ path }.war ... --> </target> <target name="deploy" description="Install web application" depends="compile"> <deploy url="${ url }" username="${ username }" password="${ password }" path="${ path }" war="${ build }${ path }.war"/> </target> <target name="reload" description="Reload web application" depends="compile"> <reload url="${ url }" username="${ username }" password="${ password }" path="${ path }"/> </target> <target name="undeploy" description="Remove web application"> <undeploy url="${ url }" username="${ username }" password="${ password }" path="${ path }"/> </target> </project>