sesispla / docker-nginx-kestrel

A basic ASP.NET Core App, Dockerized and served with NGINX as proxy server.
MIT License
67 stars 26 forks source link

502 Bad Gateway #5

Closed bilalmalik777 closed 11 months ago

bilalmalik777 commented 5 years ago

I want to run my asp.net application at nginx server, But I am facing the following error in dev environment "502 Bad Gateway". Information of docker compose and nginx is given below respectively

-------docker compose ----------

`version: '3.4'

services: webapplication1: image: ${DOCKER_REGISTRY-}webapplication1 build: context: . dockerfile: WebApplication1/Dockerfile expose:

networks: app-network: ipam: driver: default config:

nginx.conf###

worker_processes 4;

events { worker_connections 1024; }

http { sendfile on;

upstream webapplication {
    server webapplication1:5050;
}

server {
    listen 80;

    location / {
        proxy_pass         http://webapplication;
        proxy_redirect     http://localhost http://webapplication;
        proxy_set_header   Host $host;
        proxy_set_header   X-Real-IP $remote_addr;
        proxy_set_header   X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header   X-Forwarded-Host $server_name;

    }
}

}

Please help me to solve this issue