簡體   English   中英

在 AWSEB 命令行上部署 django 應用程序時,如何修復 502 Bad Gateway NGINX 錯誤?

[英]How can i fix 502 Bad Gateway NGINX error while deploying a django app on AWSEB command line?

我一直在嘗試在 awsebcli 上部署 django 應用程序。 我立即輸入 eb open 命令,在我的 web 瀏覽器上得到 502 Bad Gateway NGINX 錯誤。 請我需要有關如何修復此錯誤的幫助,以便更好地查看和理解我的代碼截圖在上傳鏈接中,如下所示.. settings.py .. 502 bad gateway ..elasticbeanstalk/config.yml .. .ebextensions\ django.config .. aswebcli_status .. django_pip_freeze

我期待着您的友好回應。 謝謝

亞馬遜Linux 2平台上的Python 3.7+確實需要gunicorn。 就我而言,我只需要 pip 安裝 gunicorn 並將其添加到 requirements.txt 中。 我不需要編輯 setting.py 文件。 我的 django.config 如下所示:

option_settings:
  aws:elasticbeanstalk:container:python:
    WSGIPath: ebdjango.wsgi:application

參考: 關於使用 Beanstalk 部署 Django 的 AWS 文檔

對於 Python 3.7 Amazon Linux 2 平台的 ebs 首先安裝 gunicorn 然后將其添加到您的 requirements.txt 並編輯 django.config 文件

option_settings: 
  "aws:elasticbeanstalk:application:environment": 
    DJANGO_SETTINGS_MODULE: "elernet.settings" 
    "PYTHONPATH": "/var/app/current:$PYTHONPATH"
  "aws:elasticbeanstalk:container:python": 
    WSGIPath: elernet.wsgi:application 
    NumProcesses: 3 
    NumThreads: 20 

eb 部署
eb 打開

檢查文件web.stdout.log 它應該告訴你錯誤是什么。 您可以通過下載 EB 日志或運行eb ssh並在/var/log/目錄中找到它來訪問它。

暫無
暫無

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

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