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
CodePudding user response:
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).