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:
After some fast googling i found: http://developernote.com/2012/09/how-i-fixed-nginx-502-bad-gateway-error/
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?
The nginx server is before my docker instance.
Another way to extend Elastic Beanstalk nginx config is to create a file in the
.ebextensions
directory, named for examplenginx.config
with the following content :/etc/nginx/conf.d/000_my_config.conf
is the filename which will be created on the Elastic Beanstalk EC2 instances. By default this configuration is in the file/etc/nginx/conf.d/00_elastic_beanstalk_proxy.conf
. So if you prefix with 000, it guarantees you that your configuration will be taken into account first.The content has been copied from the default nginx configuration (
/etc/nginx/conf.d/00_elastic_beanstalk_proxy.conf
again), then customized with my own configuration.Amazon actually recommends editing the staging version of the nginx deployment file. There are several located at
/tmp/deployment/config/
, one for editing the general 'http' context, and then a few for configuring different aspects of the server.I wanted to attach caching functionality to the default proxy server, so I wrote an
.ebextensions
config file to replace#etc#nginx#conf.d#00_elastic_beanstalk_proxy.conf
, which is then copied over to/etc/nginx/conf.d
during deployment. You can inline the file if its simple enough, but I put mine in S3 so that different applications and pull it down and use it. Here's the config file:I also needed to modify the nginx configuration.
/etc/nginx/sites-enabled/elasticbeanstalk-nginx-docker.conf
) and restarts the nginx service (service nginx restart
).An example ebextension config is
.ebextensions/01modify_nginx.config
:This is working nicely now for my project (here is the source where you can see it in action).
A cleaner approach (if you're using the Java or Go platform on Elastic Beanstalk) is to have nginx .conf files with your wished changes in a subfolder in .ebextensions:
Source