提问人:Andy Salim Rojas Hinojosa 提问时间:5/24/2023 更新时间:5/24/2023 访问量:225
我想使用 Apache Server 2 在 Ubuntu 终端上本地部署一个 SpringBoot 应用程序,但它遇到了一个错误
I want to deploy locally a SpringBoot app on Ubuntu Terminal with Apache Server 2, but it encounters an error
问:
Apache 会议:
/etc/apache2/sites-available/andyrojaslab08.tk.conf
<VirtualHost *:80>
ServerName andyrojaslab08.tk
DocumentRoot /var/www/andyrojaslab08.tk/repo333
ProxyPreserveHost on
ProxyPass / http://127.0.0.1:8080/
ProxyPassReverse / http://127.0.0.1:8080/
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
来自 Apache 的错误日志:
[proxy_http:error] [pid 7970:tid 140567970084416] [client 127.0.0.1:33122] AH01114: HTTP: failed to make connection to backend: 127.0.0.1
Connection refused AH00957: http: attempt to connect to 127.0.0.1:8080 (127.0.0.1) failed
etc/hosts:
127.0.0.1 andyrojaslab08.tk
127.0.1.1 andyrojaslab08.tk
192.168.139.128 andyrojaslab08.tk
::1 ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
PROYECT结构:
andy@andy-virtual-machine:/var/www/andyrojaslab08.tk/repo333$ ls
app.yaml HELP.md mvnw mvnw.cmd pom.xml src target
项目路径:
andy@andy-virtual-machine:/var/www/andyrojaslab08.tk$ ls
goodbst.jar Lab02-Rojas-0.0.1-SNAPSHOT.jar lab08xy.jar repo333
来自 Proyect 的 app.yaml:
runtime: java17
server.port=8080
来自我的项目的资源:
andy@andy-virtual-machine:/var/www/andyrojaslab08.tk/repo333/src/main/resources$ ls
application.properties static templates
application.properties:
spring.jpa.show-sql = true
spring.jpa.hibernate.ddl-auto = update
spring.datasource.url =jdbc:mysql://xxxxxx:3306/xxxxxx
spring.datasource.username =xxxxx
spring.datasource.password =xxxxx
spring.thymeleaf.prefix=classpath:/templates/
spring.thymeleaf.suffix=.html
server.port=8080
错误:
andy@andy-virtual-machine:/$ curl andyrojaslab08.tk
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>503 Service Unavailable</title>
</head><body>
<h1>Service Unavailable</h1>
<p>The server is temporarily unable to service your
request due to maintenance downtime or capacity problems. Please try again later.</p>
<hr>
<address>Apache/2.4.52 (Ubuntu) Server at andyrojaslab08.tk Port 80</address>
</body></html>
网络上的错误:
(我在 html 中使用 thymeleaf,我的 html 文件在 src/main/resources/templates 中)
(我正在使用来自云的mysql数据库,我已经验证问题不是从那里来的)
(我的css文件在src/main/resources/static中)
(我正在使用 apache2)
(我安装了 Maven)
答: 暂无答案
评论
java -jar <your app>.jar