簡體   English   中英

aws beanstalk nodejs:如何覆蓋 nginx 的 60 秒超時

[英]aws beanstalk nodejs: how to override 60s timeout of nginx

我想在 AWS elastic beanstalk 的 nodejs 環境中增加默認超時 nginx,我遵循本指南: https://medium.com/swlh/using-ebextensions-to-extend-nginx-default-configuration-in -aws-elastic-beanstalk-189b844ab6ad但它不起作用,如果我上傳我的應用程序,我會收到此錯誤在實例 ID“i-xxxxxxxxxx”上執行命令失敗。 中止操作。 有什么建議嗎? 我正在嘗試使用 .ebextension,這是我的 01-timeout.config 文件的代碼

files:
"/etc/nginx/conf.d/01-timeout.conf":
 mode: “000644”
 owner: root
 group: root
 content: |
   keepalive_timeout 600s;
   proxy_connect_timeout 600s;
   proxy_send_timeout 600s; 
   proxy_read_timeout 600s; 
   fastcgi_send_timeout 600s; 
   fastcgi_read_timeout 600s;
container_commands:
  nginx_reload:
   command: "sudo service nginx reload"

謝謝你的幫助。

現在更新部署沒問題,但是超時不起作用,就像以前一樣超時60秒,閱讀日志似乎重新加載了nginx,這是消息:命令nginx_reload成功,任何線索是什么問題?

.ebextension 方法現在不起作用。請嘗試.platform方法。

請在項目根文件夾中創建一個名為.platform的文件夾。

.platform/
         nginx/
              conf.d/
                    timeout.conf
         00_myconf.config

文件 1 的內容 - timeout.conf (在.platform/nginx/conf.d/文件夾內)

keepalive_timeout 600s;
proxy_connect_timeout 600s;
proxy_send_timeout 600s; 
proxy_read_timeout 600s; 
fastcgi_send_timeout 600s; 
fastcgi_read_timeout 600s;

文件 2 的內容 - 00_myconf.config (在.platform/文件夾內)

container_commands:
  01_reload_nginx:
    command: "service nginx reload"

重新上傳您的應用程序並查看更改。

您的/etc/nginx/conf.d/01-timeout.conf被忽略,因為這是基於 Amazon Linux 1 (AL2) 的 EB 平台的有效文件。 但是,在我看來,您使用的是基於 Amazon Linux 2 (EB) 的最新版本的 EB。

對於 AL2,nginx 設置應該在.platform/nginx/conf.d/中,而不是在“反向代理配置”部分的文檔中所示的.ebextentions中。

因此,您可以擁有以下.platform/nginx/conf.d/myconfig.conf內容:

keepalive_timeout 600s;
proxy_connect_timeout 600s;
proxy_send_timeout 600s; 
proxy_read_timeout 600s; 
fastcgi_send_timeout 600s; 
fastcgi_read_timeout 600s;

不需要使用sudo service nginx reload手動重啟 nginx。

請像這樣嘗試:

files:
  "/etc/nginx/conf.d/01-timeout.conf":
    mode: "000644"
    owner: root
    group: root
    content: |
      keepalive_timeout 600s;
      proxy_connect_timeout 600s;
      proxy_send_timeout 600s; 
      proxy_read_timeout 600s; 
      fastcgi_send_timeout 600s; 
      fastcgi_read_timeout 600s;

container_commands:
  nginx_reload:
    command: "sudo service nginx reload"

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM