Docker NGINX reverse proxy for microservices and single page applications
docker network create reverse-proxy-network
docker network rm reverse-proxy-network
cd app-be
docker build -t app-be .
docker run --name app-be -it -d --network reverse-proxy-network app-be
cd app-fe
docker build -t app-fe .
docker run --name app-fe -it -d --network reverse-proxy-network app-fe
cd nginx-reverse-proxy
docker build -t nginx-reverse-proxy .
docker run --name nginx-reverse-proxy -it -d -p 8000:80 --network reverse-proxy-network nginx-reverse-proxy
NGINX Reverse Proxy and app-fe
http://localhost/app-be/v1/get
Run with configuration as volume
docker run -d --name nginx-proxy \
--network my_network \
-p 80:80 \
-v $(pwd)/nginx-conf/nginx.conf:/etc/nginx/conf.d/default.conf \
nginx
Configuration Angular FE
export const environment = {
production: true,
useHash: false,
serverUrl: 'http://localhost:8000/app-be/v1/get',
};
export const environment = {
production: true,
useHash: false,
serverUrl: 'http://example.com/app-be/v1/get',
};
Private or public
export const environment = {
production: true,
useHash: false,
serverUrl: 'http://192.168.1.100:8000/app-be/v1/get',
};