Elastic Beanstalk返回503错误

时间:2016-11-02 00:15:49

标签: apache amazon-web-services nginx amazon-ec2 elastic-beanstalk

我的Elastic Beanstalk应用程序在容量错误时返回503服务器。我知道当应用程序无法访问时会发生这种情况,但应用程序在其他任何地方都是稳定的,我已对其进行了测试。

我认为问题在于我的nginx.conf覆盖:

"/opt/elasticbeanstalk/#etc#nginx#conf.d#00_elastic_beanstalk_proxy.conf" :
mode: "000664"
owner: root
group: root
encoding: plain
content: |
  #WE COME FROM env.config!
    upstream nodejs {
      server 127.0.0.1:8081;
      keepalive 256;
     }
     server {
      listen 80;
        if ($time_iso8601 ~ "^(\d{4})-(\d{2})-(\d{2})T(\d{2})") {
            set $year $1;
            set $month $2;
            set $day $3;
            set $hour $4;
        }
        access_log /var/log/nginx/healthd/application.log.$year-$month-$day-$hour healthd;
        access_log  /var/log/nginx/access.log  main;

        location / {
          root /var/app/current/public/dist;
          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;
        }

        gzip on;
        gzip_comp_level 4;
        gzip_types text/html text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript;

     }

container_commands:
01_replace_nginx_eb_conf:
command: "mv -f        '/opt/elasticbeanstalk/#etc#nginx#conf.d#00_elastic_beanstalk_proxy.conf' '/tmp/deployment/config/#etc#nginx#conf.d#00_elastic_beanstalk_proxy.conf'"
ignoreErrors: false

我希望能够为我的'dist'应用程序的文件夹,其中包含通过EBS的React Web应用程序。

我对DevOps或nginx不太熟悉。这里是否有任何明显的问题会导致我的应用程序始终为503?

0 个答案:

没有答案