I follow this tutorial
https://bentranz.medium.com/deploy-dockerized-application-to-aws-elastic-beanstalk-f8a3cf2944a7
After successfully debugging and finally running my server and nginx containers on AWS, I started receiving the following log
Here’s my docker-compose.yml
version: '3.8'
services:
server:
image: **************.us-east-2.amazonaws.com/howdy-api-production:latest
container_name: howdyserver
platform: linux/amd64
restart: always
environment:
- RDS_USER=${RDS_USER}
- RDS_PASSWORD=${RDS_PASSWORD}
- RDS_SERVER=${RDS_SERVER}
- RDS_PORT=${RDS_PORT}
- RDS_DB=${RDS_DB}
- REDIS_PORT=${REDIS_PORT}
- SECRET_KEY=${SECRET_KEY}
- SMTP_SENDER_ADDRESS=${SMTP_SENDER_ADDRESS}
- SENDGRID_API_KEY=${SENDGRID_API_KEY}
- AWS_KEY_ID=${AWS_KEY_ID}
- AWS_SECRET_KEY=${AWS_SECRET_KEY}
- AWS_SECRET_KEY=${AWS_SECRET_KEY}
build:
context: ./server
dockerfile: backend.Dockerfile
volumes:
- ./server/app/:/app/
- public_assets:/app/shared/public
ports:
- 8000:8000
networks:
- howdynetwork
nginx:
image: nginx:alpine
container_name: howdynginx
platform: linux/amd64
restart: always
ports:
- 80:80
depends_on:
- server
volumes:
- public_assets:/app/shared/public
- ./nginx.conf:/etc/nginx/conf.d/default.conf
networks:
- howdynetwork
volumes:
public_assets:
networks:
howdynetwork:
driver: bridge
And here’s my nginx.conf
upstream api {
server server:8000;
}
server {
listen 80;
# Uncomment this line when you have your own domain for the api.
# server_name example.org www.example.org;
client_max_body_size 10m;
keepalive_timeout 60s;
access_log /dev/stdout;
error_log stderr;
location / {
try_files $uri @api;
}
location @api {
proxy_pass http://api;
proxy_http_version 1.1;
proxy_set_header Host $host;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-Port $server_port;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_redirect off;
}
location /public {
alias /app/public;
gzip_static on;
expires max;
add_header Cache-Control public;
}
error_page 500 502 503 504 /500.json;
location = /500.json {
return 500 '{"statusCode": 500, "message": "Something went wrong."}';
}
}
Any ideas why this is happening?
Thank you!
I tried several different Nginx nginx.conf but each happened to have the same result.