[英]How to set up tomcat context path for web application? .war file name is coming infront of the application name in the url
I am having a trouble getting my web application 'xyz' running in tomcat 7 server hosted in DigitalOcean servers at: 我在使用在DigitalOcean服务器中托管的tomcat 7服务器中运行我的Web应用程序'xyz'时遇到问题:
http://myDomain:8080/myWebApp HTTP:// myDomain的:8080 / myWebApp
The name of my .war file is ".MyWebApp". 我的.war文件的名称是“.MyWebApp”。
after deploying the .war file in tomcat, the application starts at: 在tomcat中部署.war文件后,应用程序从以下位置开始:
http://myDomain:8080/MyWebApp/myWebApp HTTP:// myDomain的:8080 / MyWebApp / myWebApp
any idea how to remove this "MyWebApp" part from the URL? 任何想法如何从URL中删除此“MyWebApp”部分?
I have seen some of the solutions for this problem, they are mostly solutions of running the application in localhost. 我已经看到了这个问题的一些解决方案,它们主要是在localhost中运行应用程序的解决方案。 They suggested to change the 'context.xml' file which I already did like this:
他们建议更改我已经这样做的'context.xml'文件:
<?xml version='1.0' encoding='utf-8'?>
<Context>
<!-- Default set of monitored resources -->
<WatchedResource>WEB-INF/web.xml</WatchedResource>
<WatchedResource>${catalina.base}/conf/web.xml</WatchedResource>
path="" docBase="MyWebApp" debug="0" reloadable="true"
</Context>
Any help would be very much appreciated! 任何帮助将非常感谢!
Do not mark this as duplicate. 不要将其标记为重复。 I have checked all the solutions which worked for me in localhost, but not in digital ocean VPS.
我已经检查了在localhost中为我工作的所有解决方案,但没有检查数字海洋VPS。 I think I am pretty specific here.
我想我在这里非常具体。
Thank you in advance! 先感谢您!
I had to add this line in in the server.xml file. 我不得不在server.xml文件中添加这一行。 Tod do this:
Tod这样做:
nano etc/tomcat/server.xml
nano etc / tomcat / server.xml
add this line: 添加此行:
<Context path="" docBase="Advocatoree" debug="0" reloadable="true"></Context>
Save the file. 保存文件。
Restart tomcat. 重启tomcat。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.