How to change nginx config in amazon elastic beanstalk running a docker instance

后端 未结 4 719
抹茶落季
抹茶落季 2020-12-04 15:31

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         


        
4条回答
  •  日久生厌
    2020-12-04 16:23

    Another way to extend Elastic Beanstalk nginx config is to create a file in the .ebextensions directory, named for example nginx.config with the following content :

        files:
          "/etc/nginx/conf.d/000_my_config.conf":
          content: |
            upstream nodejsserver {
              server 127.0.0.1:8081;
              keepalive 256;
            }
    
            server {
              listen 8080;
    
              location / {
                proxy_pass  http://nodejsserver;
                proxy_set_header   Connection "";
                proxy_http_version 1.1;
                proxy_set_header        Host            $host;
                proxy_set_header        X-Real-IP       $remote_addr;
                proxy_set_header        X-Forwarded-For $proxy_add_x_forwarded_for;
              }
    
              location /myconfig {
                proxy_pass http://my_proxy_pass_host;
              }
            }
    

    /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.

提交回复
热议问题