是否有人使用格式化的nginx.config文件来升级AWS EB以允许Web套接字?很高兴看到你的示例nginx.config文件。我发现我需要从这个link设置nginx.config。
这是我在尝试其他事情之前想要的工作,但是我通过YAML验证器提供的各种类似版本给出了部署错误:
files:
/etc/nginx/conf.d/proxy.conf:
content: |
http {
client_max_body_size 50M;
}
client_max_body_size 50M;
upstream nodejs {
server 127.0.0.1:8081;
keepalive 256;
}
server {
listen 8080;
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 / {
proxy_pass http://nodejs;
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;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
}
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;
location /static {
alias /var/app/current/static;
}
}
container_commands:
removeconfig:
command: "rm -f /tmp/deployment/config/#etc#nginx#conf.d#00_elastic_beanstalk_proxy.conf /etc/nginx/conf.d/00_elastic_beanstalk_proxy.conf"
我已经尝试了十几种我在互联网上找到的格式无济于事,包括以下链接:
Web Socket Issue for Node.js app on AWS EB for Parse Live Query