I'm running a rails application on Ruby 2.0/Puma instances and am trying to customize the nginx configuration. I need to increase the permitted request size to allow file uploads. I've found some other posts that have lead me to add this to my .ebextensions:
files:
"/etc/nginx/conf.d/proxy.conf" :
mode: "000755"
owner: root
group: root
content: |
client_max_body_size 70M;
That does create the file as expected, but it doesn't seem to work until I manually restart nginx. Because of that, I've tried to figure out a way to restart nginx with .ebextensions commands, but haven't had any success. Does anyone know of a way to restart nginx with .ebextensions or know of a better approach to solving this problem?
this is my configuration and worked for me. You have to include it inside of the http block.
I got it working like this. No need to restart or reload nginx since the
commands
(and notcontainer_commands
) runes BEFORE the application deploy.To reload the nginx config, you can use container_commands
From http://www.infoq.com/news/2012/11/elastic-beanstalk-config-files:
I found a way to restart nginx after deployment using an undocumented technique for running post-deployment scripts. I added this to my .ebextensions:
I might be a little late with the response here, but I've discovered another, less intrusive way to configure nginx on Elastic Beanstalk. You can specify configuration files for nginx directly by creating an
.ebextensions/nginx/conf.d
directory. Any config files found inside are automatically copied to your/etc/nginx/conf.d/
directory during the EB deployment. This seems to be a more robust solution.Documentation available here: https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/java-se-nginx.html
EDIT: As pointed out in comments, Elastic Beanstalk has inconsistent implementations between platforms. The documentation here is for Java SE, and it appears this documentation is not relevant for all platforms.