Skip to content

Config docker-compose with nginx reverse proxy and config cache 1 day for proxy.

License

Notifications You must be signed in to change notification settings

nguyenvantien2009/nginx-reverse-proxy

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Nginx Proxy Docker Compose

Build Docker Image from Dockerfile in Docker Compose

1. Create a reverse proxy.

FROM nginx:alpine
 
COPY nginx.conf /etc/nginx/nginx.conf
RUN apk update && apk add bash

2. Create Docker Compose to run 3 docker container of Nginx

Refer to docker-compose.yaml.

Mount Nginx Config of proxy for easy updating

In the path ./reverse-proxy/nginx.conf we define proxy directive help passed to original server. But in the development process, we need change on a regular basis. Mount it to local directory will a good solution for easy for using.

Diff in Github

     ports:
       - 8080:8080
       - 8081:8081
+    volumes:
+      - ./reverse-proxy/nginx.conf:/etc/nginx/nginx.conf
     # restart: always

Nginx Proxy Caching

For any reason, we need cache between original server to reverse proxy. Nginx support config cache with expire time, limit size of cache...

./public/img/diff-cache-config.png

References

  1. Docker Compose Nginx Reverse Proxy Multiple Containers https://www.bogotobogo.com/DevOps/Docker/Docker-Compose-Nginx-Reverse-Proxy-Multiple-Containers.php
  2. Introduction to Docker Compose - https://www.baeldung.com/ops/docker-compose

About

Config docker-compose with nginx reverse proxy and config cache 1 day for proxy.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published