[英]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.