如何将Spring Web应用程序上传到cPanel? [英] How to upload a spring web application to cPanel?
问题描述
我刚刚支付了主机托管费用,现在我想上传我的spring应用程序.我只是进行配置以从我的应用程序部署.war.但是该.war文件位于哪里,如何将其从cPanel上传到public_html?
I just payed for my hosting and now I want to upload my spring App. I just made the configuration to deploy a .war from my app. But where is this .war located and how can I upload it into public_html from cPanel ?
这是配置我的.war的配置:
This is what the configuration in order to deploy my .war :
主要:
@SpringBootApplication
public class Application extends SpringBootServletInitializer {
@Override
protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
return application.sources(Application.class);
}
public static void main(String[] args) throws Exception {
SpringApplication.run(Application.class, args);
}
}
pom.xml:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<packaging>war</packaging>
<groupId>groupId</groupId>
<artifactId>crisanRaoulBlog</artifactId>
<version>1.0-SNAPSHOT</version>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
</plugins>
</build>
<properties>
<spring.version>4.0.5.RELEASE</spring.version>
<spring-security.version>3.2.4.RELEASE</spring-security.version>
</properties>
</project>
那么我如何访问我部署的战争,以便将其压缩为zip并上传到服务器上?
So how can I access the war that I deployed in order to compress it into a zip and upload on the server ?
推荐答案
Cpanel根据他们的引用支持tomcat 7. https://documentation.cpanel.net/display/EA/Introduction+to+Tomcat
Cpanel supports tomcat 7 according to they ref. https://documentation.cpanel.net/display/EA/Introduction+to+Tomcat
所以您需要将本地Java版本修改为1.7
so you need to modify your local java version to 1.7
在Mac上,您具有/usr/libexec/java_home -V来查看所有Java版本
on mac you have /usr/libexec/java_home -V to see all your java versions
您当前的Java版本:java -version
your current java version : java -version
导出JAVA_HOME = /usr/libexec/java_home -v 1.7
以选择Java 1.7
export JAVA_HOME=/usr/libexec/java_home -v 1.7
to select java 1.7
以该示例为例 https://github.com/spring-projects/spring-boot/tree/master/spring-boot-samples/spring-boot-sample-war 属性更改->项目面孔-> Java 1.7 并设置您的jre系统库-Java 1.7
take this example https://github.com/spring-projects/spring-boot/tree/master/spring-boot-samples/spring-boot-sample-war change in properties->project faces -> java 1.7 and set you jre system library - java 1.7
,它是这里的指南: http://docs.spring.io/spring-boot/docs/current/reference/htmlsingle/#howto-create-a-deployable-war-file 这是一个很棒的文档:)
and it's a guide here: http://docs.spring.io/spring-boot/docs/current/reference/htmlsingle/#howto-create-a-deployable-war-file it's a great doc :)
要测试是否正常,您可以从此处下载tomcat的副本: https://tomcat.apache.org/download-70.cgi ->二进制dist . (我用tar.gz)
to test if is working you can download a copy of tomcat from here: https://tomcat.apache.org/download-70.cgi -> binary dist. (i take tar.gz)
如果使用eclipse或sts,则可以从服务器控制台->新建-> tomcat7->设置tomcat inst运行本地服务器.目录到tomcat文件夹(但在运行tomcat文件夹更改权限之前:chmod + x/tomcat)->设置JRE 1.7
if you use eclipse or sts you can run a local server from the server console -> new -> tomcat7 -> set tomcat inst. dir. to tomcat folder (but before running change permision to tomcat folder : chmod +x /tomcat) -> set JRE 1.7
如果该服务器上可以运行,则可以将其部署到cpanel
if it's work on this server you can deploy it to cpanel
如果您具有root用户访问权限,则可以在此处查看跟踪信息:vi/var/log/easy-tomcat7/catalina.err错误或vi/var/log/easy-tomcat7/catalina.out
if you have root access you can see the trace here : vi /var/log/easy-tomcat7/catalina.err for errors or vi /var/log/easy-tomcat7/catalina.out
我希望它会有所帮助:)
I hope it helps :)
这篇关于如何将Spring Web应用程序上传到cPanel?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!