简体   繁体   English

AWS Elastic Beanstalk - 配置我的nginx设置以增加Java Spring maven应用程序的超时

[英]AWS Elastic Beanstalk - Configuring my nginx settings to increase timeout for Java Spring maven app

So I am using AWS Elastic Beanstalk to host my Java Spring app, and there are certain requests which take more than 60 seconds to complete. 所以我使用AWS Elastic Beanstalk来托管我的Java Spring应用程序,并且某些请求需要60多秒才能完成。 I wanted to raise the timeout cap so these could complete, so I began to follow this tutorial. 我想提高超时限额以便完成,所以我开始学习教程。

I succeeded in changing the Load Balancer timeout in the ELB console, but I am having trouble changing settings for the nginx proxy. 我成功地在ELB控制台中更改了Load Balancer超时,但是我在更改nginx代理的设置时遇到了问题。 The tutorial suggests to create a file called .ebextensions/nginx-timeout.config where .ebextensions is in the "root of my project." 本教程建议创建一个名为.ebextensions/nginx-timeout.config的文件,其中.ebextensions位于“我项目的根目录”中。 The tutorial is assuming that we are using Beanstalk with Docker, which I am not, so I found this link which suggests to fill the contents of nginx-timeout.config with these contents: 本教程假设我们正在使用带有Docker的Beanstalk,我不是,所以我发现这个链接建议用这些内容填充nginx-timeout.config内容:

files:
    "/tmp/proxy.conf":
        mode: "000644"
        owner: root
        group: root
       content: |
           proxy_send_timeout 1200;
           proxy_read_timeout 1200;
           send_timeout       1200;
container_commands:
    00-add-config:
        command: cat /tmp/proxy.conf >> /var/elasticbeanstalk/staging/nginx/conf.d/elasticbeanstalk/00_application.conf
    01-restart-nginx:
        command: service nginx restart

One of my problems is that I do not know exactly where the root of my application is. 我的一个问题是我不确切知道我的应用程序的根目录。 I am using Maven with Java Spring Boot, so my structure is as follows: 我正在使用Maven和Java Spring Boot,所以我的结构如下:

在此输入图像描述

I am not sure whether I should place .ebextensions in the base directory where my pom.xml file is, or somewhere else. 我不确定是否应该将.ebextensions放在我的pom.xml文件所在的基本目录中,或者放在其他地方。 Also the method in which I am deploying this application is using maven to build a jar, and then uploading the jar, I'm not sure if this changes anything. 我正在部署这个应用程序的方法是使用maven来构建一个jar,然后上传jar,我不确定这是否会改变任何东西。

Any advice on this problem? 关于这个问题的任何建议? I'm currently also trying to see how I might ssh into my instance to possibly change the configuration of the nginx server there, but I am not sure if that will be possible. 我目前也在试图看看我是如何ssh到我的实例可能会改变那里的nginx服务器的配置,但我不确定这是否可行。

Possible duplicate of Where to add .ebextensions in a WAR? 在WAR中添加.ebextensions的位置可能重复 , though since you are not using war packaging you can use Procfile-based configuration and archive your jar and .ebextensions into additional zip layer. 虽然因为你没有使用war包装,你可以使用基于Procfile的配置并将你的jar和.ebextensions存档到附加的zip层。 Then your zip file structure should be looking like this: 然后你的zip文件结构应如下所示:

your_app.zip
|
|_.ebextensions
|   |_ nginx-timeout.config
|
|_ your_app.jar
|_ Procfile

And your Procfile should contain your jar file launching instructions 并且您的Procfile应该包含您的jar文件启动说明

$ cat Procfile
web: java -jar your_app.jar

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

相关问题 AWS Elastic Beanstalk上的Java应用程序会话超时 - Java application session timeout on AWS Elastic Beanstalk 在AWS Elastic BeanStalk上运行的Spring Boot应用程序中配置AWS RDS - Configuring AWS RDS in a Spring Boot Application running on AWS Elastic BeanStalk 在AWS Elastic Beanstalk上部署Spring - Deploying Spring on AWS Elastic Beanstalk 结合使用AWS Elastic Beanstalk和Java / BlazeDS / Spring应用程序 - Using AWS Elastic Beanstalk with a Java/BlazeDS/Spring application AWS Elastic Beanstalk-Tomcat Java Spring Boot应用程序出现问题 - AWS Elastic Beanstalk - Problem with tomcat java spring boot application AWS(弹性Beanstalk)+ Java(春季)=原因:从远程服务器读取错误 - AWS (Elastic Beanstalk) + Java (Spring) = Reason: Error reading from remote server 在Spring Boot应用程序中为AWS Beanstalk的Nginx设置HTTP到HTTPS重定向 - Set up HTTP to HTTPS redirect for AWS Beanstalk's nginx in Spring Boot app Spring MVC在AWS Elastic Beanstalk中不起作用 - Spring mvc doesn't work in AWS elastic beanstalk 配置部署在 AWS Elastic Beanstalk 中的 Spring 应用程序以使用 SSL - Configure Spring application deployed in AWS Elastic Beanstalk to use SSL 带有SSL / HTTPS的Spring Boot项目无法在AWS Elastic Beanstalk上运行 - Spring Boot project with SSL / HTTPS not working on AWS Elastic Beanstalk
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM