Amazon web services Nginx配置在beanstalk部署期间覆盖

Amazon web services Nginx配置在beanstalk部署期间覆盖,amazon-web-services,nginx,amazon-elastic-beanstalk,Amazon Web Services,Nginx,Amazon Elastic Beanstalk,我尝试使用 尝试1 .ebextensions/000_nginx.config container_commands: 01_reload_nginx: command: "sudo echo 'underscores_in_headers on;' >> /etc/nginx/conf.d/elasticbeanstalk/00_application.conf" files: "/tmp/proxy.conf": mode: "000644"

我尝试使用

尝试1

.ebextensions/000_nginx.config

container_commands:
  01_reload_nginx:
    command: "sudo echo 'underscores_in_headers on;' >> /etc/nginx/conf.d/elasticbeanstalk/00_application.conf"
files:
  "/tmp/proxy.conf":
    mode: "000644"
    owner: root
    group: root
    content: |

      underscores_in_headers on;
container_commands:
  00-add-config:
    command: cat /tmp/proxy.conf >> /etc/nginx/conf.d/elasticbeanstalk/00_application.conf
  01-restart-nginx:
    command: /sbin/service nginx restart

尝试2

.ebextensions/000_nginx.config

container_commands:
  01_reload_nginx:
    command: "sudo echo 'underscores_in_headers on;' >> /etc/nginx/conf.d/elasticbeanstalk/00_application.conf"
files:
  "/tmp/proxy.conf":
    mode: "000644"
    owner: root
    group: root
    content: |

      underscores_in_headers on;
container_commands:
  00-add-config:
    command: cat /tmp/proxy.conf >> /etc/nginx/conf.d/elasticbeanstalk/00_application.conf
  01-restart-nginx:
    command: /sbin/service nginx restart

尝试3次

.ebextensions/nginx/conf.d/elasticbeanstalk/00_application.conf

location / {
    proxy_pass          http://127.0.0.1:5000;
    proxy_http_version  1.1;

    proxy_set_header    Connection          $connection_upgrade;
    proxy_set_header    Upgrade             $http_upgrade;
    proxy_set_header    Host                $host;
    proxy_set_header    X-Real-IP           $remote_addr;
    proxy_set_header    X-Forwarded-For     $proxy_add_x_forwarded_for;
}

underscores_in_headers on;
但每次尝试都会更新文件,然后在代码部署到Beanstalk后清除更改


如何防止覆盖配置文件或基本上如何更改Nginx配置?

在上载到EBS的存档中,您应该能够覆盖其中的Nginx配置

.ebextensions/nginx/nginx.conf

我以前也有过类似的问题。这可能是因为您正在压缩并上载整个项目文件夹,而不仅仅是项目文件夹的内容

仍然相同issue@SaiRahulAkarapu显然,这适用于java和go平台。你在用什么?Docker?此方法似乎不适用于Docker平台。我必须遵循这个方法: