1

while trying to upload a .Net 5 project to AWS beanstalk, we are getting an error that the provided directive is unknown. We tried to follow the AWS documentation for the custom conf folder structure and naming. (screenshot below).

The deployment fails and in eb-engine.log, following error is listed:

2022/07/03 20:22:13.936014 [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

if possible kindly what am doing wrong

enter image description here

Abdul Ali
  • 1,905
  • 8
  • 28
  • 50
  • 1
    Your text editor, whatever you are using, saved your `myconf.conf` file with the [BOM signature](https://en.wikipedia.org/wiki/Byte_order_mark) (most likely an UTF-8 `0xEB 0xBB 0xBF`). You should find out yourself how to remove it from the conf file. – Ivan Shatsky Jul 03 '22 at 20:49
  • Thanks . that worked. is there any specific indication that the document encoding included BOM ? – Abdul Ali Jul 03 '22 at 21:20
  • I don't think so. It is completely depended on the editor you are using. Most editors have some kind of related settings; if the BOM signature already present in the text file, default behavior will be to keep it when saving the file. – Ivan Shatsky Jul 03 '22 at 21:23
  • ok. Thanks. its Visual Studio 2022. if you like please post this as an answer and i would be happy to mark this as solved. – Abdul Ali Jul 03 '22 at 21:26

1 Answers1

1

It looks like your text editor, whatever it is, saved your myconf.conf file with the BOM signature (most likely an UTF-8 0xEB 0xBB 0xBF). Most editors have some kind of related settings; if the BOM signature already present in the text file, default behavior will be to keep it when saving the file. You need to remove this BOM signature manually and setup the editor you are using to not add this signature to the saved files (at least to any file types except the .txt ones). Having that BOM signature in the source code file can be the source of various hard tracking problems; one of the most common cases is the headers already sent by ... PHP error (the PHP engine assumes this BOM signature to be a raw output before the PHP code output, see this SO thread).

Ivan Shatsky
  • 13,267
  • 2
  • 21
  • 37
  • Thanks. Am using VS 2022. I used notepad++ to open the file and change save option to UTF-8 witout BOM. – Abdul Ali Jul 04 '22 at 22:16