1

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?

1 Answer 1

1

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.

Sign up to request clarification or add additional context in comments.

3 Comments

I have updated my post. This is one thing I had checked, no dodgy characters are there.
@DuncanPalmer There must be something wrong with the file encoding. The fact that you can't see them, it does not mean they are not there. Maybe recreate the file from scratch.
Well that's solved it!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.