I'm facing ERR_CONNECTION_TIMED_OUT while deploying django using aws elastic beanstalk.

Current status

  • Console shows that it's properly deployed. (shows OK status to me)
  • Allow inbound traffic for security group.
  • However, when I tried to connect instance using the url the elastic beanstalk provide, I've been always seeing ERR_CONNECTION_TIMED_OUT on chrome browser.

    Things I've tried.

  • Checked nginx log, and there's nothing printed out. So I suspect that Load balancer didn't route request to nginx web server.
  • tail -f /var/log/nginx/*
    
  • Connected ec2 instance using ssh, and checked nginx running with port 80 and gunicorn running with port 8000
  • [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)
    

    Could anyone please help me to find out the issue? Thanks in advance!

    Answers

    Based on the comments.

    The issue turned out to be due to django setting: django.middleware.security.SecurityMiddleware:

    The django.middleware.security.SecurityMiddleware provides several security enhancements to the request/response cycle. Each one can be independently enabled or disabled with a setting.

    Removal of the setting solved the problem.

    Logo

    开发云社区提供前沿行业资讯和优质的学习知识,同时提供优质稳定、价格优惠的云主机、数据库、网络、云储存等云服务产品

    更多推荐

    • 浏览量 4
    • 收藏 0
    • 0

    所有评论(0)