How do I customize nginx on AWS elastic beanstalk to loadbalance Meteor?

我只是一个虾纸丫 提交于 2019-12-02 21:58:29
aginsburg

With a LOT of help from AWS paid support, I got this working. The reality is I was not far off it was down to some SED syntaxt.

Here's what currently works (Gist):

option_settings:

  - option_name: AWS_SECRET_KEY
    value: <SOMESECRET>

  - option_name: AWS_ACCESS_KEY_ID
    value: <SOMEKEY>

  - option_name: PORT
    value: 8081

  - option_name: ROOT_URL
    value: <SOMEURL>

  - option_name: MONGO_URL
    value: <SOMEMONGOURL>

    - option_name: MONGO_OPLOG_URL
    value: <SOMEMONGOURL>

  - namespace: aws:elasticbeanstalk:container:nodejs
    option_name: ProxyServer
    value: nginx

    option_name: GzipCompression
    value: true

  - namespace: aws:elasticbeanstalk:container:nodejs:staticfiles

    option_name: /public
    value: /public

    container_commands:

  01_nginx_static:
    command: |
      sed -i '/\s*proxy_set_header\s*Connection/c \
              proxy_set_header Upgrade $http_upgrade;\
              proxy_set_header Connection "upgrade";\
        ' /tmp/deployment/config/#etc#nginx#conf.d#00_elastic_beanstalk_proxy.conf

In addition to this you need to got into your Load balancer and change the Listener from HTTP to TCP:

described here: http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/using-features.managing.elb.html).

Arjun Raj Jain

Have you checked out Meteor WebSocket handshake error 400 with nginx? I think their configuration might be a bit different from yours. I'm in the same boat as you, trying to get this exact same set up working.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!