在AWS Elastic Beanstalk中自定义Nginx配置 [英] Customizing Nginx Configuration in AWS Elastic Beanstalk
问题描述
我正在Ruby 2.0/Puma实例上运行Rails应用程序,并试图自定义nginx配置.我需要增加允许的请求大小以允许文件上传.我发现其他一些帖子使我将其添加到我的.ebextensions中:
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;
那确实创建了预期的文件,但是直到我手动重新启动nginx为止,它似乎不起作用.因此,我尝试了一种使用.ebextensions命令重新启动Nginx的方法,但没有取得任何成功.有谁知道用.ebextensions重新启动Nginx的方法,还是知道解决此问题的更好方法?
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?
推荐答案
我找到了一种方法,该方法是在部署后使用未记录的用于运行部署后脚本的技术来重新启动Nginx.我将此添加到我的.ebextensions中:
I found a way to restart nginx after deployment using an undocumented technique for running post-deployment scripts. I added this to my .ebextensions:
files:
"/opt/elasticbeanstalk/hooks/appdeploy/post/03_restart_nginx.sh":
mode: "000755"
owner: root
group: root
content: |
#!/usr/bin/env bash
service nginx restart
这篇关于在AWS Elastic Beanstalk中自定义Nginx配置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!