我正在尝试使用SSL配置我的Jetty.现在我只是坚持为什么它不能在HTTPS上连接.它在HTTP上工作正常.
${JETTY_HOME}/etc/jetty-https.xml
${JETTY_HOME}/etc/jetty-ssl.xml
运行docker ps -a之后:
root@myserver:/home/deploy/frontend/src/app/environments# docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
9bf8f257f8ac jetty "/docker-entrypoint.s" 2 days ago Up 14 minutes 0.0.0.0:80->8080/tcp,0.0.0.0:443->8443/tcp jetty
最后我的
${JETTY_HOME}/etc/jetty.xml
我对Jetty很新,似乎无法在线找到答案,因为所有这些文件都是自动生成的,所以我不确定我能删除什么,不能删除.
有任何想法吗?
(注意:在我的/var/lib/jetty/start.d中只有http.ini存在(不确定是否应该有https.ini))
我的防火墙状态:
Status: active
To Action From
-- ------ ----
Anywhere ALLOW somesubnet/24
22 ALLOW Anywhere
300 ALLOW Anywhere
3000 ALLOW Anywhere
3001 ALLOW Anywhere
3002 ALLOW Anywhere
3003 ALLOW Anywhere
80 ALLOW Anywhere
443 ALLOW Anywhere
8443 ALLOW Anywhere
443/tcp ALLOW Anywhere
521 ALLOW Anywhere
80,443/tcp ALLOW Anywhere
22 (v6) ALLOW Anywhere (v6)
300 (v6) ALLOW Anywhere (v6)
3000 (v6) ALLOW Anywhere (v6)
3001 (v6) ALLOW Anywhere (v6)
3002 (v6) ALLOW Anywhere (v6)
3003 (v6) ALLOW Anywhere (v6)
80 (v6) ALLOW Anywhere (v6)
443 (v6) ALLOW Anywhere (v6)
8443 (v6) ALLOW Anywhere (v6)
443/tcp (v6) ALLOW Anywhere (v6)
521 (v6) ALLOW Anywhere (v6)
80,443/tcp (v6) ALLOW Anywhere (v6)
443/tcp ALLOW OUT Anywhere
3000 ALLOW OUT Anywhere
443/tcp (v6) ALLOW OUT Anywhere (v6)
3000 (v6) ALLOW OUT Anywhere (v6)
我使用的Docker命令:
docker run -d --name=jetty -p 80:8080 -p 443:8443 -v /home/deploy/backend/my-server/target/my-server-0.0.1-SNAPSHOT.war:/var/lib/jetty/webapps/root.war -v /home/deploy/backend/ssl:/etc/ssl/private jetty
它在http://my-server.com上运行良好,但不会在https://my-server.com上加载
最佳答案
即使jetty main page on Docker Hub显示容器应该使用docker run -d -p 80:8080 -p 443:8443 jetty运行,看起来默认情况下没有为HTTPS配置映像.
原文链接:https://www.f2er.com/docker/436134.html如您所知,/ var / lib / jetty / start.d中应该有一个https.ini文件.您可以通过在容器中运行命令java -jar“$JETTY_HOME / start.jar”–add-to-startd = https来生成一个.
将此命令放在Dockerfile中:
FROM jetty
RUN java -jar "$JETTY_HOME/start.jar" --add-to-startd=https
构建新图像:
docker build -t my-server .
最后启动你的服务器:
docker run -d --name=jetty -p 80:8080 -p 443:8443 -v /home/deploy/backend/my-server/target/my-server-0.0.1-SNAPSHOT.war:/var/lib/jetty/webapps/root.war -v /home/deploy/backend/ssl:/etc/ssl/private my-server
这应该允许您使用HTTPS连接到您的服务器.
您可以在this Github issue找到更多相关信息.