I've managed to solve it by creating a zip archive with a JAR file and the .platform/nginx/conf.d/proxy.conf file with the client_max_body_size 50M; content. So the zip file has the following structure:
-- app.jar -- .platform/nginx/conf.d/proxy.conf
After that, I deployed it with the eb deploy -v. The .elasticbeanstalk/config.yml file in the source directory contains the following lines:
deploy: artifact: archive.zip