๐Ÿš€ DevOps Reverse Proxy Project

Kamlesh PariharKamlesh Parihar
2 min read

Nginx + Docker Compose + Go + Flask Microservices


๐Ÿ“ฆ Project Overview

This project sets up a Docker Compose-based environment with:

  • ๐ŸŸจ Service 1 (Go) โ€” Returns JSON from /ping and /hello

  • ๐ŸŸฆ Service 2 (Python Flask) โ€” Returns JSON from /ping and /hello

  • ๐Ÿงญ Nginx Reverse Proxy โ€” Routes traffic to both services on a single port

๐Ÿ–ผ๏ธ Screenshot


โš™๏ธ Setup Instructions

  1. Install Docker and Docker Compose

  2. Clone this repository:

  3.  git clone https://github.com/your-username/devops-nginx-proxy.git
     cd devops-nginx-proxy
    
  4. Run the entire system with:

  5.  docker compose up --build
    

Once running, visit the endpoints in your browser or use curl:


๐Ÿ” How Routing Works

Nginx is configured to proxy requests based on URL path:

  • /service1/* โžก๏ธ routed to Go app on http://service1:8001

  • /service2/* โžก๏ธ routed to Flask app on http://service2:8002

location /service1/ {
    proxy_pass http://service1:8001/;
    rewrite ^/service1(/.*)$ $1 break;
}

location /service2/ {
    proxy_pass http://service2:8002/;
    rewrite ^/service2(/.*)$ $1 break;
}

โœจ Bonus Features Implemented

  • โœ… Docker Health Checks for both services

  • โœ… Nginx Access Logs with timestamp and URL

  • โœ… Bridge Networking for container isolation

  • โœ… Single-Port Access through localhost:8080

  • ๐Ÿงช (Optional) Test-ready via CURL or browser


๐Ÿ“ Folder Structure

.
โ”œโ”€โ”€ docker-compose.yml
โ”œโ”€โ”€ nginx/
โ”‚   โ”œโ”€โ”€ nginx.conf
โ”‚   โ””โ”€โ”€ Dockerfile
โ”œโ”€โ”€ service_1/
โ”‚   โ”œโ”€โ”€ main.go
โ”‚   โ””โ”€โ”€ Dockerfile
โ”œโ”€โ”€ service_2/
โ”‚   โ”œโ”€โ”€ app.py
โ”‚   โ”œโ”€โ”€ requirements.txt
โ”‚   โ””โ”€โ”€ Dockerfile
โ””โ”€โ”€ README.md

๐Ÿง  Author & Notes

Developed as part of a DevOps internship assignment.
Built using Linux-friendly, reproducible Docker containers.
Note: Do not use Flask's built-in server for production.

1
Subscribe to my newsletter

Read articles from Kamlesh Parihar directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Kamlesh Parihar
Kamlesh Parihar

๐Ÿš€ Cloud | DevOps | Scripting Enthusiast Hi, Iโ€™m Kamlesh Parihar โ€” a passionate DevOps learner and tech blogger who thrives on solving problems with automation, cloud-native tools, and clean code. I write about AWS, CI/CD, Docker, Kubernetes, Python scripting, and anything that simplifies development and operations. ๐Ÿง  Sharing insights, tutorials, and real-world project experiences to help others grow in their DevOps journey. ๐Ÿ“š Lifelong learner. Open-source supporter. Tech community advocate. โœ๏ธ Follow along as I break down complex DevOps concepts into simple, actionable posts.