如何改变nginx的配置在亚马逊弹性魔豆运行的泊坞窗实例 [英] How to change nginx config in amazon elastic beanstalk running a docker instance

查看:176
本文介绍了如何改变nginx的配置在亚马逊弹性魔豆运行的泊坞窗实例的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我登录的Cookie设置,我得到错误502,当我读到的日志我得到的错误:

After i login and the cookie is set I get error 502. When i read the log i get the error:

014/05/17 01:54:43 [error] 11013#0: *8 upstream sent too big header while reading response
header from upstream, client: 83.248.134.236, server: , request: "GET /administration
HTTP/1.1", upstream:

在一些快速google搜索,我发现: <一href="http://developernote.com/2012/09/how-i-fixed-nginx-502-bad-gateway-error/">http://developernote.com/2012/09/how-i-fixed-nginx-502-bad-gateway-error/

After some fast googling i found: http://developernote.com/2012/09/how-i-fixed-nginx-502-bad-gateway-error/

和我想尝试设置fastcgi_buffers和fastcgi_buffer_size为不同的值。 但我怎么对nginx的亚马逊elasticbeanstalk变盘?

and I want to try to set fastcgi_buffers and fastcgi_buffer_size to a different value. But how do i set variable on nginx in amazon elasticbeanstalk?

nginx的服务器是我的泊坞窗实例前。

The nginx server is before my docker instance.

推荐答案

我还需要修改nginx的配置。

I also needed to modify the nginx configuration.

  1. 创建可修改nginx的配置脚本(可能是你想要 /etc/nginx/sites-enabled/elasticbeanstalk-nginx-docker.conf ),并重新启动nginx的服务(服务nginx的重启)。
  2. 您需要的是这样写nginx的配置文件,这是正常的ebextensions执行后后执行该脚本。这是无证的,但埃文分享如何做到这一点<一个href="http://stackoverflow.com/questions/24812375/websockets-on-elastic-beanstalk-with-docker">here:基本上你使用ebextension的脚本复制到一个目录,获取在适当的时候执行的钩子。
  1. Create a script that modifies the nginx configuration (probably you want /etc/nginx/sites-enabled/elasticbeanstalk-nginx-docker.conf) and restarts the nginx service (service nginx restart).
  2. You need to execute that script after this nginx config file is written which is after normal ebextensions are executed. This is undocumented, but Evan shared how to do this here: essentially you use an ebextension to copy the script into a directory with hooks that gets executed at the proper time.

这是例子ebextension配置是 .ebextensions / 01modify_nginx.config

An example ebextension config is .ebextensions/01modify_nginx.config:

container_commands:
  copy:
    command: "cp .ebextensions/01rewrite_nginx_config.py /opt/elasticbeanstalk/hooks/appdeploy/enact/"
  make_exe:
    command: "chmod +x /opt/elasticbeanstalk/hooks/appdeploy/enact/01rewrite_nginx_config.py"

这是工作很好,现在我的项目(​​这里是源,你可以看到它在行动)。

This is working nicely now for my project (here is the source where you can see it in action).

这篇关于如何改变nginx的配置在亚马逊弹性魔豆运行的泊坞窗实例的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆