AWS Elastic Beanstalk Django网站赢得';我没有出现
我已经将Python3.6/AmazonLinux的ElasticBeanstalk与Django1.11一起设置。 该应用程序已通过EB CLI成功上载并安装AWS Elastic Beanstalk Django网站赢得';我没有出现,django,amazon-web-services,apache,amazon-ec2,amazon-elastic-beanstalk,Django,Amazon Web Services,Apache,Amazon Ec2,Amazon Elastic Beanstalk,我已经将Python3.6/AmazonLinux的ElasticBeanstalk与Django1.11一起设置。 该应用程序已通过EB CLI成功上载并安装 INFO Deploying new version to instance(s). INFO New application version was deployed to running EC2 instances. INFO Environment update completed successfully.
INFO Deploying new version to instance(s).
INFO New application version was deployed to running EC2 instances.
INFO Environment update completed successfully.
set.config文件没有错误:
option_settings:
aws:elasticbeanstalk:application:environment:
DJANGO_SETTINGS_MODULE: myproject.settings
SECRET_KEY: TempKey
aws:elasticbeanstalk:container:python:
WSGIPath: myproject/wsgi.py
EB可以很好地解析wsgi.py
我已将当前的EB地址(如projectname.us-west-1.elasticbeanstalk.com)包含在允许的_主机中
然而,在所有这些“无错误”过程之后,实际的网站不会出现。(当EB示例应用程序运行时)甚至没有400500个错误消息页面。没有Django错误消息,无论DEBUG=True还是False。只是浏览器显示一个空白的超时页面
当我使用python manage.py runserver
在本地环境中运行Django时,它工作得很好
-------------------------------------
/var/log/httpd/error_log
-------------------------------------
[mpm_prefork:notice] [pid 3150] AH00169: caught SIGTERM, shutting down
[suexec:notice] [pid 20456] AH01232: suEXEC mechanism enabled (wrapper: /usr/sbin/suexec)
[so:warn] [pid 20456] AH01574: module wsgi_module is already loaded, skipping
[http2:warn] [pid 20456] AH10034: The mpm module (prefork.c) is not supported by mod_http2. The mpm determines how things are processed in your server. HTTP/2 has more demands in this regard and the currently selected mpm will just not do. This is an advisory warning. Your server will continue to work, but the HTTP/2 protocol will be inactive.
[http2:warn] [pid 20456] AH02951: mod_ssl does not seem to be enabled
[lbmethod_heartbeat:notice] [pid 20456] AH02282: No slotmem from mod_heartmonitor
[:warn] [pid 20456] mod_wsgi: Compiled for Python/3.6.2.
[:warn] [pid 20456] mod_wsgi: Runtime using Python/3.6.12.
[mpm_prefork:notice] [pid 20456] AH00163: Apache/2.4.46 (Amazon) mod_wsgi/3.5 Python/3.6.12 configured -- resuming normal operations
[core:notice] [pid 20456] AH00094: Command line: '/usr/sbin/httpd -D FOREGROUND'
-------------------------------------
/opt/python/log/supervisord.log
-------------------------------------
INFO stopped: httpd (exit status 0)
INFO spawned: 'httpd' with pid 20456
INFO success: httpd entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
-------------------------------------
/var/log/httpd/access_log
-------------------------------------
127.0.0.1 (-) - - [+0000] "GET / HTTP/1.1" 301 - "-" "Python-urllib/2.7"
127.0.0.1 (-) - - [+0000] "GET / HTTP/1.1" 301 - "-" "Python-urllib/2.7"
127.0.0.1 (-) - - [+0000] "GET / HTTP/1.1" 301 - "-" "Python-urllib/2.7"
127.0.0.1 (-) - - [+0000] "GET / HTTP/1.1" 301 - "-" "Python-urllib/2.7"
-------------------------------------
/var/log/eb-activity.log
-------------------------------------
INFO [3223] - [Application deployment app-51cc-29999@52/StartupStage0/EbExtensionPostBuild/Infra-EmbeddedPostBuild] : Starting activity...
INFO [3223] - [Application deployment app-51cc-29999@52/StartupStage0/EbExtensionPostBuild/Infra-EmbeddedPostBuild/postbuild_0_myproject_test_1/Test for Command 01_migrate] : Completed activity. Result:
Completed successfully.
Operations to perform:
Apply all migrations: admin, .....
Running migrations:
No migrations to apply.
INFO [3223] - [Application deployment app-51cc-29999@52/StartupStage0/EbExtensionPostBuild] : Completed activity.
INFO [3223] - [Application deployment app-51cc-29999@52/StartupStage0/InfraCleanEbExtension] : Starting activity...
INFO [3223] - [Application deployment app-51cc-29999@52/StartupStage0/InfraCleanEbExtension] : Completed activity. Result:
Cleaned ebextensions subdirectories from /opt/python/ondeck/app.
INFO [3223] - [Application deployment app-51cc-29999@52/StartupStage0] : Completed activity. Result:
Application deployment - Command CMD-Startup stage 0 completed
INFO [3223] - [Application deployment app-51cc-29999@52/StartupStage1/AppDeployEnactHook/01flip.py] : Completed activity. Result:
httpd: stopped
httpd: started
httpd RUNNING pid 20456, uptime 0:00:03
INFO Apache is running, but root page is not responding in 3 seconds.
INFO [3223] - [Application deployment app-51cc-29999@52/StartupStage1/AppDeployEnactHook/02create_pids_for_monitoring.sh] : Starting activity...
INFO [3223] - [Application deployment app-51cc-29999@52/StartupStage1/AppDeployEnactHook/02create_pids_for_monitoring.sh] : Completed activity. Result:
+ chmod 0755 /var/run/httpd
+ /opt/elasticbeanstalk/bin/healthd-track-pidfile --proxy httpd
+ /opt/elasticbeanstalk/bin/healthd-track-pidfile --name application --location /opt/python/run/supervisord.pid
INFO [3223] - [Application deployment app-51cc-29999@52/StartupStage1/AppDeployEnactHook] : Completed activity. Result:
Successfully execute hooks in directory /opt/elasticbeanstalk/hooks/appdeploy/enact.
INFO [3223] - [Application deployment app-51cc-29999@52/StartupStage1/AppDeployPostHook] : Starting activity...
INFO [3223] - [Application deployment app-51cc-29999@52/StartupStage1/AppDeployPostHook] : Completed activity. Result:
Successfully execute hooks in directory /opt/elasticbeanstalk/hooks/appdeploy/post.
INFO [3223] - [Application deployment app-51cc-29999@52/StartupStage1/PostInitHook] : Starting activity...
INFO [3223] - [Application deployment app-51cc-29999@52/StartupStage1/PostInitHook/01processmgrstart.sh] : Starting activity...
INFO [3223] - [Application deployment app-51cc-29999@52/StartupStage1/PostInitHook/01processmgrstart.sh] : Completed activity. Result:
+ pgrep supervisord
3064
INFO [3223] - [Application deployment app-51cc-29999@52/StartupStage1/PostInitHook] : Completed activity. Result:
Successfully execute hooks in directory /opt/elasticbeanstalk/hooks/postinit.
INFO [3223] - [Application deployment app-51cc-29999@52/StartupStage1] : Completed activity. Result:
Application deployment - Command CMD-Startup stage 1 completed
INFO [3223] - [Application deployment app-51cc-29999@52/AddonsAfter] : Starting activity...
INFO [3223] - [Application deployment app-51cc-29999@52/AddonsAfter/ConfigLogRotation] : Starting activity...
INFO [3223] - [Application deployment app-51cc-29999@52/AddonsAfter/ConfigLogRotation/10-config.sh] : Starting activity...
[2021-01-01T05:23:11.925Z] INFO [3223] - [Application deployment app-51cc-29999@52/AddonsAfter/ConfigLogRotation/10-config.sh] : Completed activity. Result:
Disabled forced hourly log rotation.
INFO [3223] - [Application deployment app-51cc-29999@52/AddonsAfter/ConfigLogRotation] : Completed activity. Result:
Successfully execute hooks in directory /opt/elasticbeanstalk/addons/logpublish/hooks/config.
INFO [3223] - [Application deployment app-51cc-29999@52/AddonsAfter] : Completed activity.
INFO [3223] - [Application deployment app-51cc-29999@52] : Completed activity. Result:
Application deployment - Command CMD-Startup succeeded
INFO [20664] - [CMD-TailLogs] : Starting activity...
-------------------------------------
/var/log/eb-commandprocessor.log
-------------------------------------
INFO [3223] : Instance is Leader.
DEBUG [3223] : Loaded 7 actions for stage 0.
INFO [3223] : Running stage 1 of command CMD-Startup...
DEBUG [3223] : Loaded 3 actions for stage 1.
INFO [3223] : Command CMD-Startup succeeded!
INFO [3223] : Command processor returning results:
{"status":"SUCCESS","api_version":"1.0","results":[{"status":"SUCCESS","msg":"","returncode":0,"events":[]}]}
DEBUG [20664] : Reading config file: /etc/elasticbeanstalk/.aws-eb-stack.properties
DEBUG [20664] : Checking if the command processor should execute...
DEBUG [20664] : Checking whether the command is applicable to instance (i-007e4078e1a342421)..
INFO [20664] : Command is applicable to this instance (i-007e4078e1a342421)..
DEBUG [20664] : Checking if the received command stage is valid..
INFO [20664] : No stage_num in command. Valid stage..
INFO [20664] : Received command CMD-TailLogs: {"execution_data"=>"*", "instance_ids"=>["i-007e4078e1a342421"], "data"=>"dfd6c391-1fa0-433d-916d-2696608b221a", "command_name"=>"CMD-TailLogs", "api_version"=>"1.0", "resource_name"=>"AWSEBAutoScalingGroup", "request_id"=>"dfd6c391-1fa0-433d-916d-2696608b221a"}
INFO [20664] : Command processor should execute command.
DEBUG [20664] : Storing current stage..
DEBUG [20664] : Stage_num does not exist. Not saving null stage. Returning..
DEBUG [20664] : Reading config file: /etc/elasticbeanstalk/.aws-eb-stack.properties
DEBUG [20664] : Retrieving metadata for key: AWS::ElasticBeanstalk::Ext||_ContainerConfigFileContent||commands..
DEBUG [20664] : Retrieving metadata for key: AWS::ElasticBeanstalk::Ext||_API||_Commands..
INFO [20664] : Found enabled addons: ["logstreaming", "logpublish"].
INFO [20664] : Updating Command definition of addon logstreaming.
INFO [20664] : Updating Command definition of addon logpublish.
DEBUG [20664] : Loaded definition of Command CMD-TailLogs.
DEBUG [20664] : Setting environment variables..
以下是一些可疑的部分:
INFO [3223] - [Application deployment app-51cc-29999@52/StartupStage1/AppDeployEnactHook/01flip.py] : Completed activity. Result:
httpd: stopped
httpd: started
httpd RUNNING pid 20456, uptime 0:00:03
INFO Apache is running, but root page is not responding in 3 seconds.
以及
127.0.0.1(-)-[+0000]“GET/HTTP/1.1”301-“-”Python urllib/2.7”
我尝试在EC2 SSH上手动重新启动httpd,刷新EB环境和应用程序,使用https和HTTP,使用EC2 IP地址,然后从头开始重新启动,但都不起作用
有什么线索可以解决这个问题吗?如果你用ssh连接到EB实例,你能从内部卷曲你的应用程序以确认它能按预期工作吗?@Marcin doing
curl-L 127.0.0.1
显示了Django页面的源代码。消息为:无效的HTTP_主机头:“127.0.0.1”。您可能需要将“127.0.0.1”添加到允许的\u主机。但是,即使将127.0.0.1 localhost添加到允许的\u主机后,错误消息仍然是相同的。只是为了快速临时测试,如果您设置ALLOWED\u HOSTS=[*]
它会改变什么吗?@Marcin ok。。现在显示curl:(7)无法连接到127.0.0.1端口80:连接被拒绝
。与端口443相同。(httpd正在运行)奇怪的是,即使我撤销了更改允许的\u主机
,它仍然表示拒绝。端口80将是httpd/nginx端口。dinago应用程序端口如何(默认值为8000)?如果您使用ssh连接到EB实例,是否可以从内部对应用程序进行卷曲,以确认其工作正常?@Marcin doingcurl-L 127.0.0.1
显示Django页面的源代码。消息为:无效的HTTP_主机头:“127.0.0.1”。您可能需要将“127.0.0.1”添加到允许的\u主机。但是,即使将127.0.0.1 localhost添加到允许的\u主机后,错误消息仍然是相同的。只是为了快速临时测试,如果您设置ALLOWED\u HOSTS=[*]
它会改变什么吗?@Marcin ok。。现在显示curl:(7)无法连接到127.0.0.1端口80:连接被拒绝
。与端口443相同。(httpd正在运行)奇怪的是,即使我撤销了更改允许的\u主机
,它仍然表示拒绝。端口80将是httpd/nginx端口。您的dinago应用程序端口如何(默认值为8000)?