我已在配置了 nginx 服务器的弹性 beantalk 上部署了我的 nodejs rest API,但出现以下错误:
View(WhatsApp.Chat.with.Yaswanth)
history <- "WhatsApp.Chat.with.Yaswanth.txt"
chat_clean <- chat_clean %>%
filter(!word %in% to_remove)
我尝试了很多东西,还在我的根目录中添加了一个 .ebextensions 文件夹,其中包含一个名为 nginx.config 的文件,该文件具有以下由 aws 文档提供的配置,但它似乎仍然无法正常工作。我花了 3 天时间试图解决这个问题,但我无法解决。如果有人能帮我解决这个问题,我将不胜感激
我的nginx配置如下:
2021/03/03 15:01:15 [error] 18614#0: *1381 upstream prematurely closed connection while reading response header from upstream, client: 172.31.17.180, server: , request: "GET / HTTP/1.1", upstream: "http://127.0.0.1:8080/", host: "172.31.43.117"
2021/03/03 15:01:30 [error] 18614#0: *1385 upstream prematurely closed connection while reading response header from upstream, client: 172.31.17.180, server: , request: "GET / HTTP/1.1", upstream: "http://127.0.0.1:8080/", host: "172.31.43.117"
2021/03/03 15:01:45 [error] 18614#0: *1389 upstream prematurely closed connection while reading response header from upstream, client: 172.31.17.180, server: , request: "GET / HTTP/1.1", upstream: "http://127.0.0.1:8080/", host: "172.31.43.117"
答案 0 :(得分:0)
您尝试使用的 nginx
设置 (/etc/nginx/conf.d/proxy.conf
) 适用于 Amazon Linux 1。
由于您可能使用的是 Amazon Linux 2 (AL2),因此您应该使用不同的文件来设置 nginx。对于 AL2,nginx
设置应在 .platform/nginx/conf.d/
中,而不是在 docs 中所示的 .ebextentions
中。或者,如果您想完全覆盖主 nginx.conf
,您应该使用 .platform/nginx/nginx.conf
提供其自定义版本。
假设你的 nginx 配置没问题,你可以尝试创建文件 .platform/nginx/conf.d/myconf.conf
,内容为:
upstream nodejs {
server 127.0.0.1:5000;
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;
}
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;
}
}