提问人:Citanionarrei 提问时间:11/1/2023 最后编辑:Citanionarrei 更新时间:11/5/2023 访问量:31
通信 FE BE 部署 Angular Java Spring Boot
Communication FE BE Deployment Angular Java Spring Boot
问:
我有一个问题,可能是一件非常愚蠢的事情。 我正在尝试部署我的一个项目,其中包括 Angular 前端和 Java Spring Boot 后端 在 Ubuntu 环境(Raspberry)上,我已使用 apache2 正确部署了前端 o,并且还正确部署了后端(运行 jar 文件)Tomcat 并侦听 8090 端口。 通过访问浏览器的 IP 地址 192.168.1.85,我可以查看前端的登录页面。但是当我尝试与它交互并调用登录 API 时,我收到错误
404 未找到 未找到 在此服务器上找不到请求的 URL。 Apache/2.4.57 (Ubuntu) 服务器位于 192.168.1.85 端口 80
如果我检查通过浏览器检查调用的 API,我会看到登录 API 是在此端点上调用的:“**http://192.168.1.85/api/authentication/login**”,并且出现 404 Not Found 错误
如果我尝试通过 postman 调用相同的 API,例如调用这个“http://192.168.1.85:8090/api/authentication/login”端点(将 8090 服务器端口插入 url),后端会正确响应。
这是我的mypersonaldomain.com在/etc/apache2/sites-available下
<VirtualHost *:80>
ServerAdmin [email protected]
DocumentRoot /var/www/mypersonaldomain.com/html
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
apache2 配置中缺少什么? 如何将前端连接到后端?
这个答案是隐藏的。这个答案昨天被 rveerd, Ian Campbell, user16217248, pmacfarlane 删除了。 我试图将 ProxyPass 添加到 apache2 conf 中
<VirtualHost *:80>
ProxyPreserveHost On
ProxyPass / http://localhost:8090/
ServerAdmin [email protected]
DocumentRoot /var/www/mypersonaldomain.com/html
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
但是当我重新加载和重新分配 Web 服务器时,前端似乎关闭了。.我收到 503 错误
Service Unavailable
The server is temporarily unable to service your request due to maintenance downtime or capacity problems. Please try again later.
Apache/2.4.57 (Ubuntu) Server at 192.168.1.85 Port 80
with systemctl status apache2.service i see this
apache2.service - The Apache HTTP Server
Loaded: loaded (/lib/systemd/system/apache2.service; enabled; preset: enabled)
Active: active (running) since Fri 2023-11-03 08:49:11 CET; 9min ago
Docs: https://httpd.apache.org/docs/2.4/
Process: 67804 ExecStart=/usr/sbin/apachectl start (code=exited, status=0/SUCCESS)
Main PID: 67808 (apache2)
Tasks: 55 (limit: 8706)
Memory: 5.6M
CPU: 256ms
CGroup: /system.slice/apache2.service
├─67808 /usr/sbin/apache2 -k start
├─67809 /usr/sbin/apache2 -k start
└─67810 /usr/sbin/apache2 -k start
nov 03 08:49:11 lock-desktop systemd[1]: Starting apache2.service - The Apache HTTP Server...
nov 03 08:49:11 lock-desktop apachectl[67807]: AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1. Set the 'ServerName' >
nov 03 08:49:11 lock-desktop systemd[1]: Started apache2.service - The Apache HTTP Server.```
答: 暂无答案
评论