![](/img/trans.png)
[英]How to setup gunicorn with nginx while using aws elastic beanstalk for a django app
[英]ERR_CONNECTION_TIMED_OUT while deploying django using AWS elastic beanstalk(with nginx + gunicorn)
我在使用 aws elastic beanstalk 部署 django 時面臨 ERR_CONNECTION_TIMED_OUT。
當前狀態
但是,當我嘗試使用彈性 beanstalk 提供的 url 連接實例時,我一直在 chrome 瀏覽器上看到 ERR_CONNECTION_TIMED_OUT。
我嘗試過的事情。
tail -f /var/log/nginx/*
[ec2-user@ip-172-31-0-29 ~]$ sudo lsof -i -P -n | grep LISTEN
rpcbind 2650 rpc 8u IPv4 16321 0t0 TCP *:111 (LISTEN)
rpcbind 2650 rpc 11u IPv6 16324 0t0 TCP *:111 (LISTEN)
master 3130 root 13u IPv4 18639 0t0 TCP 127.0.0.1:25 (LISTEN)
sshd 3328 root 3u IPv4 20466 0t0 TCP *:22 (LISTEN)
sshd 3328 root 4u IPv6 20475 0t0 TCP *:22 (LISTEN)
ruby 3475 healthd 6u IPv4 22081 0t0 TCP 127.0.0.1:22221 (LISTEN)
nginx 4778 root 6u IPv4 392465 0t0 TCP *:80 (LISTEN)
nginx 4780 nginx 6u IPv4 392465 0t0 TCP *:80 (LISTEN)
gunicorn 4796 webapp 5u IPv4 392820 0t0 TCP 127.0.0.1:8000 (LISTEN)
gunicorn 4806 webapp 5u IPv4 392820 0t0 TCP 127.0.0.1:8000 (LISTEN)
gunicorn 4807 webapp 5u IPv4 392820 0t0 TCP 127.0.0.1:8000 (LISTEN)
gunicorn 4808 webapp 5u IPv4 392820 0t0 TCP 127.0.0.1:8000 (LISTEN)
有人可以幫我找出問題嗎? 提前致謝!
根據評論。
問題原來是由於django 設置: django.middleware.security.SecurityMiddleware :
django.middleware.security.SecurityMiddleware 為請求/響應周期提供了多項安全增強功能。 每個都可以通過設置獨立啟用或禁用。
刪除設置解決了問題。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.