如何为Web应用程序设置tomcat上下文路径? .war文件名在url中的应用程序名称前面 [英] How to set up tomcat context path for web application? .war file name is coming infront of the application name in the url

查看:447
本文介绍了如何为Web应用程序设置tomcat上下文路径? .war文件名在url中的应用程序名称前面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我无法让我的网络应用程序'xyz'在DigitalOcean服务器中托管的tomcat 7服务器上运行:

I am having a trouble getting my web application 'xyz' running in tomcat 7 server hosted in DigitalOcean servers at:

http:// myDomain:8080 / myWebApp

我的.war文件的名称是。在tomcat中部署.war文件后,MyWebApp。

The name of my .war file is ".MyWebApp".

,应用程序从以下位置开始:

after deploying the .war file in tomcat, the application starts at:

http:// myDomain:8080 / MyWebApp / myWebApp

任何想法如何从URL中删除这个MyWebApp部分?

any idea how to remove this "MyWebApp" part from the URL?

我见过这个问题的一些解决方案,它们主要是在localhost中运行应用程序的解决方案。他们建议更改我已经这样做的'context.xml'文件:

I have seen some of the solutions for this problem, they are mostly solutions of running the application in localhost. They suggested to change the 'context.xml' file which I already did like this:

<?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>

非常感谢任何帮助!

不要将其标记为重复。我已经检查了所有在localhost中为我工作的解决方案,但没有检查数字海洋VPS。我想我在这里非常具体。

Do not mark this as duplicate. I have checked all the solutions which worked for me in localhost, but not in digital ocean VPS. I think I am pretty specific here.

提前谢谢你!

推荐答案

我不得不在server.xml文件中添加这一行。
Tod这样做:

I had to add this line in in the server.xml file. Tod do this:


nano etc / tomcat / server.xml

nano etc/tomcat/server.xml

添加以下行:

 <Context path="" docBase="Advocatoree" debug="0" reloadable="true"></Context>

保存文件。

重启tomcat 。

这篇关于如何为Web应用程序设置tomcat上下文路径? .war文件名在url中的应用程序名称前面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆