相关疑难解决方法(0)

在AWS Elastic Beanstalk上增加Nginx conf中的client_max_body_size

将大于10MB的文件发布到AWS Elastic Beanstalk上运行的API时,我遇到"413 Request Entity Too Large"错误.

我做了很多研究,并且相信我需要为Nginx 启动client_max_body_size,但是我似乎无法找到有关如何使用Elastic Beanstalk执行此操作的任何文档.我的猜测是需要使用ebetension文件进行修改.

任何人都有关于如何达到极限的想法?10MB非常弱,必须有一种方法可以手动启动它.

nginx amazon-ec2 amazon-web-services amazon-elastic-beanstalk

105
推荐指数
12
解决办法
4万
查看次数

通过 maven for Spring Boot 应用程序为 AWS Beanstalk 创建 .ebextensions 的正确方法是什么

hosts在 GitLab CI/CD 管道期间,我们必须在 Spring Boot 应用程序的动态生成的 Elastic Beanstalk 实例中自定义文件。为此,我们需要提供一个.ebextensions包含如下配置文件的目录:

commands:
  01_add_hosts:
    command: echo 123.12.12.123 myhost.com >> /etc/hosts
Run Code Online (Sandbox Code Playgroud)

由于我们有一个spring boot应用程序,我们必须.ebextensions在我们的fat jar的根级别进行打包。所以,基本上我们解压缩 jar,添加 ebextensions 目录并将其压缩回来。这样我们就成功地在我们的 Gitlab 管道中实现了 Beanstalk 定制。

但是,要进行此过程,我们可以maven-antrun-plugin这样使用:

<!-- Bundle .ebextensions inside jar -->
<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-antrun-plugin</artifactId>
    <version>1.8</version>
    <executions>
        <execution>
            <id>prepare</id>
            <phase>package</phase>
            <configuration>
                <tasks>
                    <unzip src="${project.build.directory}/${project.build.finalName}.jar" dest="${project.build.directory}/${project.build.finalName}" />
                    <copy todir="${project.build.directory}/${project.build.finalName}/" overwrite="false">
                        <fileset dir="./" includes=".ebextensions/**"/>
                    </copy>
                    <zip compress="false" destfile="${project.build.directory}/${project.build.finalName}.jar" basedir="${project.build.directory}/${project.build.finalName}"/>
                </tasks>
            </configuration>
            <goals>
                <goal>run</goal>
            </goals>
        </execution>
    </executions>
</plugin>
Run Code Online (Sandbox Code Playgroud)

问题是这maven-antrun-plugin是 2014 年的旧插件,这看起来不是实现此捆绑 …

java amazon-web-services maven spring-boot gitlab-ci

0
推荐指数
2
解决办法
1169
查看次数