简体   繁体   English

在 cpanel 中部署 angular 中的前端和 java 中的后端

[英]Deploy frontend in angular and backend in java in cpanel

I have used angular framework for frontend development and created spring boot application for backend.我使用 angular 框架进行前端开发,并为后端创建了 spring 引导应用程序。 To run my application on my local server(my computer), I first run spring boot application in eclipse and angular application through angular cli. To run my application on my local server(my computer), I first run spring boot application in eclipse and angular application through angular cli. But how can I deploy and host my project to cpanel?但是如何将我的项目部署和托管到 cpanel?

Step 1) Angular build command - "ng build --prod".步骤 1) Angular 构建命令 - “ng build --prod”。 This will create a dist folder in you angular project main directory, if you navigate in to this directory you will see folders where assets, index.html, main.xxxxxxxx.js, polyfills.xxxxxxxx.js and runtime.xxxxxxxxx.js etc will be available这将在您 angular 项目主目录中创建一个 dist 文件夹,如果您导航到此目录,您将看到 assets、index.html、main.xxxxxxxx.js、polyfills.xxxxxxxx.js 和 runtime.xxxxxxxxx.js 等文件夹能得到的

Angular dist folder (miracleApp is my app name, so all files will be under this) Angular dist 文件夹(miracleApp 是我的应用名称,所以所有文件都会在这个下)

Step 2) Copy all the above files from the dist directory and paste them in src/main/resources directory of your java project步骤 2) 从 dist 目录复制上述所有文件并将它们粘贴到 java 项目的 src/main/resources 目录中

Java Project Java项目

Step 3) Now do a maven build (hope yours is a maven project) using "package" as the goal and if build is successful you will see a target folder with either a jar or a war (depending on what you choose packaging option in pom.xml) file which will have all your angular and java code and ready to use步骤 3)现在使用“包”作为目标进行 maven 构建(希望您的项目是 maven 项目),如果构建成功,您将看到一个目标文件夹,其中包含 Z68995FCBF432492D15484D04A9D 包装选项或您选择的包装选项pom.xml) 文件,其中将包含所有 angular 和 java 代码并可以使用

Step 4) Now go to your service providers cpanel (make sure your service provider accepts java application deployments and not just php, I faced this issue sometime back where service providers allow only php applications) and use this packaged jar or war file for deployment on the provided server Step 4) Now go to your service providers cpanel (make sure your service provider accepts java application deployments and not just php, I faced this issue sometime back where service providers allow only php applications) and use this packaged jar or war file for deployment on提供的服务器

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM