Home > Back-end >  .NET Core WebAPI - AWS ElasticBeanstalk Nginx Configuration
.NET Core WebAPI - AWS ElasticBeanstalk Nginx Configuration

Time:05-17

I've moved my .NET Core WebAPI to an AWS EB Instance. This works fine, however my file upload has now broken due to the Nginx 'client_max_body_size' configuration.

I've looked up how to override this, however I cannot get this to work. Here is my current set-up: enter image description here

Within this file I have added:

client_max_body_size 0;

This file has no hidden characters (Notepad with show all chars on):

enter image description here

When my EB environment is updated I get the following eb-engine log:

2022/05/17 07:15:57.025994 [ERROR] An error occurred during execution of command [app-deploy] - [FlipProxyForDotNetCore]. Stop running the command. Error: copy proxy conf from staging failed with error validate nginx configuration failed with error Command /bin/sh -c /usr/sbin/nginx -t -c /var/proxy/staging/nginx/nginx.conf failed with error exit status 1. Stderr:nginx: [emerg] unknown directive "client_max_body_size" in /var/proxy/staging/nginx/conf.d/myConf.conf:1
nginx: configuration file /var/proxy/staging/nginx/nginx.conf test failed

My EB instance is running Amazon Linux 2/2.3.1.

What am I doing wrong?

CodePudding user response:

The error msg

"client_max_body_size"

indicates that you have some non-ASCII characters () in your myConf.conf. Please open the file in a regular text editor and verify that it has only ASCII characters.

  • Related