使用curl将war文件部署到远程tomcat 8

时间:2017-08-13 00:15:45

标签: tomcat curl deployment

从远程机器A,我想向运行tomcat的机器B部署战争

我在机器B上的tomcat-users.xml中设置了以下内容

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

从机器A,我运行以下命令

$ curl -T "test.war" "http://tomcat:tomcat@<machine b>:8080/manager/text/deploy?path=/temp&update=true" -v
*   Trying machine B IP...
* Connected to (machine B IP) port 8080 (#0)
* Server auth using Basic with user 'tomcat'
> PUT /manager/text/deploy?update=true HTTP/1.1
> Host: <machine b>:8080
> Authorization: Basic dG9tY2F0OnRvbWNhdA==
> User-Agent: curl/7.47.0
> Accept: */*
> Content-Length: 374778991
> Expect: 100-continue
>
< HTTP/1.1 404 Not Found
< Server: Apache-Coyote/1.1
< Content-Length: 0
< Date: Sun, 13 Aug 2017 00:12:37 GMT
* HTTP error before end of send, stop sending
<
* Closing connection 0

我尝试打开经理页面 http:<machine b>8080/manager/html,但它没有打开。我不确定我是否缺少任何配置或上下文路径不正确。

1 个答案:

答案 0 :(得分:0)

我通过在ubuntu上下载tomcat6-admin然后复制原始tomcat 8的webapps文件夹中的manager目录解决了这个问题。