/deploy 的 Tomcat 7 tomcat-users manager-script 示例 [英] Tomcat 7 tomcat-users manager-script example for /deploy
问题描述
我正在尝试让管理器/部署在我新安装的 Tomcat 7.0.34 上工作,但是当我尝试通过在 http://localhost:8080/上执行 PUT 进行部署时,我不断收到 403经理/部署
.我还没有让它在 Tomcat 7 中工作.
I'm trying to get manager/deploy working on my new installation of Tomcat 7.0.34, but I keep getting a 403 when I try to deploy by doing a PUT on http://localhost:8080/manager/deploy
. I've yet to get this working in Tomcat 7.
conf/server.xml
<?xml version='1.0' encoding='utf-8'?>
<Server>
...
<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>
...
<Engine>
...
<Realm className="org.apache.catalina.realm.UserDatabaseRealm"
resourceName="UserDatabase"/>
</Engine>
</Service>
</Server>
conf/tomcat-users.xml
<?xml version='1.0' encoding='utf-8'?>
<tomcat-users>
<user username="tomcat" password="redacted" roles="manager-script"/>
</tomcat-users>
我也试过(结果相同)
conf/tomcat-users.xml
<?xml version='1.0' encoding='utf-8'?>
<tomcat-users>
<role rolename="manager-script"/>
<user username="tomcat" password="redacted" roles="manager-script"/>
</tomcat-users>
是的,我已经两次、三次、四次检查我使用的用户名和密码是否正确,如 tomcat-users.xml 中所定义.我以为这就是我所需要的.有什么想法吗?
And yes, I've double, triple, quadruple checked that I'm using the correct username and password, as defined in the tomcat-users.xml. I thought this was all I needed. Any ideas?
推荐答案
所以,我终于想通了!
首先,上面的所有设置都是正确的(上面的tomcat-users版本都是正确的,但我认为第一个是更正确的.
First, all of the settings above are correct (either version of tomcat-users above is correct, but I think the first one is more correct.
最初可能不清楚,但我是从 Tomcat 6 迁移的.我缺少的是我要 PUT 到的 URL.本来应该是:http://localhost:8080/manager/**text**/deploy
It may not have been clear, originally, but I was migrating from Tomcat 6. What I was missing was the URL that I was PUTting to. It should have been:
http://localhost:8080/manager/**text**/deploy
现在一切正常.我希望这对未来的人有所帮助:)
Now everything works great. I hope this helps somebody in the future :)
这篇关于/deploy 的 Tomcat 7 tomcat-users manager-script 示例的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!