简体   繁体   English

AWS Elastic Beanstalk(单实例):如何为 Spring 启动应用程序启用 HTTPS?

[英]AWS Elastic Beanstalk (single instance) : how to enable HTTPS for a Spring Boot application?

I recently started exploring AWS and have successfully deployed a Spring Boot application on a single Elastic Beanstalk instance.我最近开始探索 AWS,并在单个 Elastic Beanstalk 实例上成功部署了 Spring Boot 应用程序。 As a next step, I'd like to have my application use HTTPS.作为下一步,我想让我的应用程序使用 HTTPS。 Given that my app is packaged as a jar, I strictly followed this official documentation: Terminating HTTPS on EC2 instances running Java SE .鉴于我的应用程序被打包为 jar,我严格遵循此官方文档: 在运行 Java SE 的 EC2 实例上终止 HTTPS

But my app still works with HTTP only.但我的应用程序仍然仅适用于 HTTP。 Did anybody managed to do so?有没有人设法做到这一点? Any help or link to a working example would be appreciated.任何帮助或指向工作示例的链接将不胜感激。

Some technical details about my app: it's a Maven-based Spring Boot project.关于我的应用程序的一些技术细节:它是一个基于 Maven 的 Spring 引导项目。 As explained in the doc, I've created the +.ebextensions+ folder with all the config files at the root of my project.正如文档中所解释的,我在项目的根目录下创建了包含所有配置文件的 +.ebextensions+ 文件夹。 I then used maven-antrun-plugin to include the.ebextensions folder in the jar file.然后我使用 maven-antrun-plugin 将 .ebextensions 文件夹包含在 jar 文件中。

Thanks in advance for your answers.提前感谢您的回答。

Its likely that you are using current version of EB, which is for Amazon Linux 2 (AL2);您可能正在使用当前版本的 EB,它适用于Amazon Linux 2 (AL2); not stated in the question what is used.问题中没有说明使用的是什么。 The tutorial you've linked uses old version of the EB, which is for Amazon Linux 1 (AL1).您链接的教程使用旧版本的 EB,它适用于Amazon Linux 1 (AL1)。

Subsequently, it will not work.随后,它将无法正常工作。 Specifically, the nginx settings from the tutorial ( .ebextensions/nginx/conf.d/ and .ebextensions/nginx/conf.d/https.conf ) will be ignored .具体来说,教程中的nginx设置( .ebextensions/nginx/conf.d/.ebextensions/nginx/conf.d/https.conf )将被忽略 The reason is that for AL2, the nginx settings should be provided using .platform/nginx/conf.d and .platform/nginx/nginx.conf .原因是对于 AL2,应使用.platform/nginx/conf.d.platform/nginx/nginx.conf提供nginx设置。

Also please be aware that there are many differences between AL1 and AL2 in EB, and more changes may be required in the tutorial to make it work on AL2:另请注意,EB 中的 AL1 和 AL2 之间存在许多差异,教程中可能需要进行更多更改才能使其在 AL2 上工作:

Since its not explicitly stated in your question, which version of EB are you using, if this is indeed AL2, you could try running your app using old version of AL1.由于在您的问题中没有明确说明您使用的是哪个版本的 EB,如果这确实是 AL2,您可以尝试使用旧版本的 AL1 运行您的应用程序。 This at least would enable you to confirm that it actually works.这至少可以让您确认它确实有效。 Then you could think of how to port it to AL2.然后你可以考虑如何将它移植到 AL2。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何将Spring Boot应用程序大战部署到AWS Elastic Beanstalk? - How to deploy Spring Boot application war to AWS Elastic Beanstalk? aws 弹性 beantalk 上的 HTTP 到 HTTPS 不适用于 Spring Boot - HTTP to HTTPS on aws elastic beanstalk not working for Spring Boot Spring Boot Application无法在AWS Elastic Beanstalk中进行一次身份验证 - Spring Boot Application not authenticating once in AWS Elastic Beanstalk AWS Elastic Beanstalk-Tomcat Java Spring Boot应用程序出现问题 - AWS Elastic Beanstalk - Problem with tomcat java spring boot application 使用自动 SSL 证书在 AWS Elastic Beanstalk 上部署 Spring Boot 应用程序 - Deploy Spring Boot application on AWS Elastic Beanstalk with automatic SSL certificates 如何在 Tomcat AWS Elastic beanstalk (Spring Boot Application) 中修改或添加新的 Nginx 配置 - How to modify or add new Nginx configuration in Tomcat AWS Elastic beanstalk (Spring Boot Application) 使用Elastic BeansTalk CLI部署Spring Boot应用程序 - Deploy Spring Boot application with Elastic BeansTalk CLI AWS Elastic Beanstalk上的Spring Boot / Tomcat仅显示404页面 - Spring Boot / Tomcat on AWS Elastic Beanstalk only showing 404 page 在AWS Elastic Beanstalk上部署Spring Boot应用程序 - 获得502错误 - Deploying Spring Boot app on AWS Elastic Beanstalk — getting 502 error 如何在AWS Elastic Beanstalk部署的Java Web应用程序中启用WebSocket请求 - How to Enable WebSocket request in AWS Elastic Beanstalk deployed Java web application
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM