[英]Tomcat6 -> how to put a project into the root folder?
I have a Tomcat6 server on a Linux server. 我在Linux服务器上有一个Tomcat6服务器。 The structure of the
webapps
directory is: webapps
目录的结构为:
I have a web application running on my localhost on a Tomcat. 我有一个在Tomcat上的本地主机上运行的Web应用程序。 I created a war file
MyProject.war
and put it into the webapps directory. 我创建了一个战争文件
MyProject.war
并将其放入webapps目录。 Restarting the Tomcat server, the war is extracted and I have this structure: 重新启动Tomcat服务器,战争被解压缩,我具有以下结构:
Calling the URL http://mysubdomain.mysite.com:8080/
I get the Tomcat start page with 调用URL
http://mysubdomain.mysite.com:8080/
我得到了Tomcat起始页
If you're seeing this page with a web browser, it means you've setup Tomcat successfully.
如果您正在通过Web浏览器看到此页面,则意味着您已经成功设置了Tomcat。 Congratulations!.
恭喜!
Calling http://mysubdomain.mysite.com:8080/MyProject/
I get the page of my project. 调用
http://mysubdomain.mysite.com:8080/MyProject/
我得到了项目的页面。
What I want, is that I can access my project with the URL http://mysubdomain.mysite.com:8080/
and not with http://mysubdomain.mysite.com:8080/MyProject/
我想要的是我可以使用URL
http://mysubdomain.mysite.com:8080/
访问我的项目,而不能访问http://mysubdomain.mysite.com:8080/MyProject/
How can I do this? 我怎样才能做到这一点?
Best Regards. 最好的祝福。
Update I have this in my server.xml: 更新我的server.xml中有这个:
<Host name="localhost" appBase="webapps" unpackWARs="true" autoDeploy="true" xmlValidation="false" xmlNamespaceAware="false">
<Context docBase="MyProject" path="/" />
</Host>
I did it on path with an empty string and / and restart Tomcat. 我使用空字符串在路径上执行了/,然后重新启动Tomcat。 Both does not work.
两者都不起作用。 The main directory shows me the Tomcat start page instead of my project.
主目录显示了Tomcat起始页,而不是我的项目。 The project is only reachable with ...:8080/MyProject/
该项目只能通过...:8080 / MyProject /访问
Delete ROOT
folder, rename MyProject.war
to ROOT.war
and restart. 删除
ROOT
文件夹,将MyProject.war
重命名为ROOT.war
并重新启动。
You can also do it by adding the following line to inside the <Host>
entry of /conf/server.xml
您也可以通过在
/conf/server.xml
的<Host>
条目内添加以下行来完成此操作
<Context docBase="MyProject" path="" />
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.