如何在 tomcat 服务器上部署 reactJS 应用程序? [英] How to deploy a reactJS application on tomcat server?

查看:44
本文介绍了如何在 tomcat 服务器上部署 reactJS 应用程序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试构建一个我想在 tomcat 服务器上托管的 ReactJS 应用程序.我已经使用了命令 npm run build 并且构建已经准备好了..我在哪里将这些文件复制到我的 tomcat 服务器中?我是否需要创建另一个应用程序并将其部署在调用 React 应用程序的服务器上?

I am trying to build a ReactJS application which i would like to host on a tomcat server. I already used the command npm run build and the build is ready.. Where do i copy these files in my tomcat server? DO i need to create another application and deploy it on the server which invokes the React Application?

推荐答案

按照以下步骤操作:

  1. 转到 tomcat 中的webapp"文件夹并创建一个文件夹(主要是您的项目名称)
  2. 将文件从你的 ReactJs 构建文件夹复制到在 tomcat 中创建的文件夹(注意:你的构建文件夹应该有 index.html)
  3. 启动 url http ://localhost:<端口 >/<浏览器中的文件夹名称>.默认端口为 8080
  1. Goto 'webapp' folder in tomcat and create a folder(mostly your project name)
  2. Copy the files from your ReactJs build folder to the folder created in tomcat(note: your build folder should have index.html)
  3. Launch the url http : //localhost:< port > /< folder-name> in browser. By default port will be 8080

如果您有 WAR 文件,则可以转到 http://localhost:<port >/manager/html 并部署它.

Instead if you have WAR file, you can go to http://localhost: < port > /manager/html and deploy it.

这篇关于如何在 tomcat 服务器上部署 reactJS 应用程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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