![](/img/trans.png)
[英]Configuring nginx client_max_body_size on Elastic Beanstalk Node
[英]I have a nginx client_max_body_size setting issue with elastic beanstalk
我正在使用帶有 codePipeline 的 elasticbeanstalk 進行部署。
我必須增加要上傳的文件大小,所以我添加 02_nginx.config 文件是我的應用程序目錄 (.ebextensions)。
這是我的 -2_nginx_config
#Elastic Beanstalk configuration for 413 Request Entity Too Large:.
container_commands:
01_reload_nginx:`enter code here`
command: "sudo service nginx reload"
files:
"/etc/nginx/conf.d/proxy.conf" :
mode: "000644"
owner: root
group: root
content: |
client_max_body_size 100M;
並且在部署時出現問題。 這是消息:
部署已完成,但出現錯誤:無法部署應用程序。 應用程序版本 code-pipeline-1600053611774-BuildArtifact-5e317627-6a37-4548-aa47-f6d4ebb03e2f 中的配置文件 .ebextensions/02_nginx.config 包含無效的 YAML 或 JSON。 YAML 異常:無效的 Yaml:掃描“<reader>”中的一個簡單鍵時,第 13 行,第 3 列:client_max_body_size 0; ^ 在“<reader>”,第 14 行,第 1 列中找不到預期的 ':': ^ ,JSON 異常:無效 JSON:位置 0 處出現意外字符 (#)。更新配置文件。
什么是問題?
您嘗試使用的nginx
設置 ( /etc/nginx/conf.d/proxy.conf
) 適用於Amazon Linux 1 。
由於您可能使用的是Amazon Linux 2,因此您應該使用不同的文件來設置 nginx。 對於 AL2,nginx 設置應該在.platform/nginx/conf.d/
,而不是在.ebextentions
,如文檔中所示。
因此,您可以擁有以下.platform/nginx/conf.d/myconfig.conf
內容:
client_max_body_size 100M;
此外,如果您使用.platform
則無需重新啟動 nginx。 所以基本上,用.platform/nginx/conf.d/myconfig.conf
替換你的my-2_nginx_config
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.