在Tomcat服务器上部署前端(ReactJS)和后端(SpringBoot)构建

时间:2021-03-03 22:03:15

标签: java reactjs spring-boot ubuntu tomcat

我已经在ubuntu机器的Tomcat服务器上部署了前端(ReactJS)和后端构建(war)。 我在 /var/lib/tomcat/webapps 文件夹中复制了两个版本。 在 ReactJS 源代码中,我添加了

Pckage.json: "homepage": "http://localhost:8080/buildFolderName"

Index.js: axios.defaults.baseURL = 'https://serverUrl/warfilename/api/'

对于此配置,我的应用程序运行良好。

但是当我们将 serverUrl 替换为 localhost:8080 时,前端应用程序没有与后端 API 通信。

在浏览器控制台上显示错误:net::ERR_CONNECTION_REFUSED

我们希望在不同的 tomcat 服务器上部署相同的构建,而不是为每个服务器创建一个构建

0 个答案:

没有答案