I'm getting this error when trying to use AWS Elastic Beanstalk to connect to my Django code:
[error] 2540#0: *1 connect() failed (111: Connection refused) while connecting to upstream, client: 172.31.23.63, server: , request: "GET / HTTP/1.1", upstream: "http://127.0.0.1:8000/", host: "172.31.14.130"
My log is displayed below:
----------------------------------------
/var/log/nginx/error.log
----------------------------------------
2020/12/21 03:43:19 [error] 2540#0: *1 connect() failed (111: Connection refused) while connecting to upstream, client: 172.31.23.63, server: , request: "GET / HTTP/1.1", upstream: "http://127.0.0.1:8000/", host: "172.31.14.130"
2020/12/21 03:43:22 [error] 2540#0: *3 connect() failed (111: Connection refused) while connecting to upstream, client: 172.31.14.160, server: , request: "GET / HTTP/1.1", upstream: "http://127.0.0.1:8000/", host: "172.31.14.130"
2020/12/21 03:43:34 [error] 2540#0: *5 connect() failed (111: Connection refused) while connecting to upstream, client: 172.31.23.63, server: , request: "GET / HTTP/1.1", upstream: "http://127.0.0.1:8000/", host: "172.31.14.130"
2020/12/21 03:43:37 [error] 2540#0: *7 connect() failed (111: Connection refused) while connecting to upstream, client: 172.31.14.160, server: , request: "GET / HTTP/1.1", upstream: "http://127.0.0.1:8000/", host: "172.31.14.130"
2020/12/21 03:43:49 [error] 2540#0: *9 connect() failed (111: Connection refused) while connecting to upstream, client: 172.31.23.63, server: , request: "GET / HTTP/1.1", upstream: "http://127.0.0.1:8000/", host: "172.31.14.130"
2020/12/21 03:43:52 [error] 2540#0: *11 connect() failed (111: Connection refused) while connecting to upstream, client: 172.31.14.160, server: , request: "GET / HTTP/1.1", upstream: "http://127.0.0.1:8000/", host: "172.31.14.130"
2020/12/21 03:44:04 [error] 2540#0: *13 connect() failed (111: Connection refused) while connecting to upstream, client: 172.31.23.63, server: , request: "GET / HTTP/1.1", upstream: "http://127.0.0.1:8000/", host: "172.31.14.130"
2020/12/21 03:44:07 [error] 2540#0: *15 connect() failed (111: Connection refused) while connecting to upstream, client: 172.31.14.160, server: , request: "GET / HTTP/1.1", upstream: "http://127.0.0.1:8000/", host: "172.31.14.130"
Previously, I also received an error where it said
Dec 21 04:14:38 ip-172-31-14-130 web: Invalid HTTP_HOST header: '172.31.14.130'. You may need to add '172.31.14.130' to ALLOWED_HOSTS.
Dec 21 04:14:38 ip-172-31-14-130 web: Bad Request: /
I did add 172.31.14.130 to the ALLOWED_HOSTS section of my settings.py file and then received the /var/log/nginx/error.log and when I try to access my webpage, it tells me the site took too long to respond - any help/suggestions would be greatly appreciated!
