如何将war文件部署到cPanel并删除项目名称? [英] How to deploy war files into cPanel and remove the project name?

查看:239
本文介绍了如何将war文件部署到cPanel并删除项目名称?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要在 cPanel 上运行我的Java应用程序。我已经成功安装了Tomcat,

I need to run my Java application on cPanel. I have successfully installed Tomcat,

我可以通过将 war 文件复制到我的 www 文件夹,但问题是它在地址中显示了项目名称( war 文件名),我需要知道如何删除,用户可以访问 www.example.com 而不是 www.example.com/MyProject/index.jsp

I can run my application by copying war file into my www folder but the problem is that it shows the Project name (war file name) in the address, I need to know how to remove that, so users can access www.example.com rather than www.example.com/MyProject/index.jsp?

推荐答案

根据一个cpanel托管服务命令提示访问通常因cpanel而关闭,您必须具体要求它。如果你有这个访问权限,你可以登录并运行unzip命令(在使用FileZilla或类似文件上传war文件后)。

According to one cpanel hosting service command prompt access is generally turned off for cpanel for security reasons and you have to ask for it specifically. If you have this access you can login and run the unzip command (after uploading the war file using FileZilla or similar).

根据 cpanel 如果你没有命令提示符访问权限,你可以将战争上传到你的 public_html 目录,但在此之前,您需要更改apache配置并为此添加JkMount(请参阅​​下面的appname)。

According to cpanel if you don't have command prompt access, you can upload the war to your public_html directory, but before doing this you need to change the apache config and add a "JkMount" for this (see the one with "appname" below).

<IfModule mod_jk.c>
  JkMount /*.jsp ajp13
  JkMount /servlet/* ajp13
  JkMount /servlets/* ajp13
  JkMount /*.do ajp13
  JkMount /appname/* ajp13
</IfModule>

除了当然你输入你的应用名称而不是appname。此更改将指示apache将对顶级URL(即mydomain.com/appname)的调用重定向到您的Tomcat实例(即mydomain.com:8080/appname)。上传战争并更改配置后,你必须重新启动apache。

Except of course you put "your app name" instead of appname. This change will instruct apache to redirect calls to the top-level url (ie mydomain.com/appname) to your Tomcat instance (ie mydomain.com:8080/appname). After you have uploaded the war and changed the config, you have to restart apache.

但我们说我们没有ssh访问权限,所以我们如何修改该文件。根据这个论坛,我们可以编辑/ home / username / public_html / .htaccess或只是/public_html/.htaccess并添加以下行:

But we said we didn't have ssh access, so how do we modify that file. according to this forum we can edit the /home/username/public_html/.htaccess or just /public_html/.htaccess and add these lines:

SetHandler jakarta-servlet
SetEnv JK_WORKER_NAME ajp13

现在,apache将重新定向到tomcat以获取mydomain.com/appname of mydomain.com:8080/appname。我们如何才能从mydomain.com开始工作?我根本就不知道答案。据我所知,使用将war文件更改为ROOT.war的常用技巧在cpanel中不起作用。

Now, apache will re-direct to tomcat for mydomain.com/appname instead of mydomain.com:8080/appname. How do we get it to work from just mydomain.com? I simply don't know the answer to this. As far as I know using the usual trick of changing the war file to ROOT.war does not work in cpanel.

这篇关于如何将war文件部署到cPanel并删除项目名称?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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