I am getting the 500:Internal Server error while trying to access the ECS container application from outside the container. The application has a heartbeat page and I can access the URL fine from the container itself.
curl -kv https://localhost/xxx/heartbeat
* About to connect() to localhost port 443 (#0)
* Trying 127.0.0.1...
* Connected to localhost (127.0.0.1) port 443 (#0)
* Initializing NSS with certpath: sql:/etc/pki/nssdb
* skipping SSL peer certificate verification
* SSL connection using TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384
* Server certificate:
*
> GET /scoutmonitor/heartbeat HTTP/1.1
> User-Agent: curl/7.29.0
> Host: localhost
> Accept: */*
>
< HTTP/1.1 200 OK
< Server: nginx/1.16.1
< Content-Type: text/html; charset=utf-8
< Transfer-Encoding: chunked
< Connection: keep-alive
<
*<h1>xxx is alive</h1>*
However, If I try to access the same URL from the ECS host instance from a my local computer browser, it fails:
curl -kv https://0.0.0.0/xxx/heartbeat
* Trying 0.0.0.0...
* TCP_NODELAY set
* Connected to 0.0.0.0 (127.0.0.1) port 443 (#0)
* ALPN, offering h2
* ALPN, offering http/1.1
* Cipher selection: ALL:!EXPORT:!EXPORT40:!EXPORT56:!aNULL:!LOW:!RC4:@STRENGTH
* successfully set certificate verify locations:
CApath: none
* TLSv1.2 (OUT), TLS header, Certificate Status (22):
* TLSv1.2 (OUT), TLS handshake, Client hello (1):
* TLSv1.2 (IN), TLS handshake, Server hello (2):
* TLSv1.2 (IN), TLS handshake, Certificate (11):
* TLSv1.2 (IN), TLS handshake, Server key exchange (12):
* TLSv1.2 (IN), TLS handshake, Server finished (14):
* TLSv1.2 (OUT), TLS handshake, Client key exchange (16):
* TLSv1.2 (OUT), TLS change cipher, Change cipher spec (1):
* TLSv1.2 (OUT), TLS handshake, Finished (20):
* TLSv1.2 (IN), TLS change cipher, Change cipher spec (1):
* TLSv1.2 (IN), TLS handshake, Finished (20):
*
> Host: 0.0.0.0
> User-Agent: curl/7.61.1
> Accept: */*
>
< HTTP/1.1 500 INTERNAL SERVER ERROR
< Server: nginx/1.16.1
< Content-Type: text/html; charset=utf-8
< Transfer-Encoding: chunked
< Connection: keep-alive
In Cloudwatch log:
1612465539291 | Starting Nginx... |
| 1612465539310 | nginx: [warn] conflicting server name "" on 0.0.0.0:80, ignored |
| 1612465539315 | [uWSGI] getting INI configuration from xxx.ini |
| 1612465583460 | "GET /xxx HTTP/1.1" 500 2381 "-" "ELB-HealthChecker/2.0" |
I have tested the docker container on my local machine and it works without any issue so it's not a problem with the image. My current setup involves:
ECS Cluster
ECS Service &
ECS Task definition
I have tried using a different task definition that has a different docker image and it works fine. I have tried increasing soft memory limit among other things on my task definition and that didn't seem to help.
Any help/advice would be much appreciated.
Thanks!
question from:
https://stackoverflow.com/questions/66056151/aws-ecs-container-500-internal-server-error 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…