Created
August 4, 2023 12:29
-
-
Save developertugrul/85c6c2749eb8c6b9fc56fb595fc9a809 to your computer and use it in GitHub Desktop.
nginx.conf
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Define upstream blocks for each microservice | |
upstream user_service { | |
server user-service-container-ip:8001; # Replace with the IP address of the user-service container and its actual port | |
} | |
upstream product_service { | |
server product-service-container-ip:8002; # Replace with the IP address of the product-service container and its actual port | |
} | |
upstream order_service { | |
server order-service-container-ip:8003; # Replace with the IP address of the order-service container and its actual port | |
} | |
# Main server block to handle incoming requests | |
server { | |
listen 80; | |
server_name api.example.com; # Replace with your actual domain or IP address | |
location /users { | |
# Route requests to the user-service | |
proxy_pass http://user_service; | |
proxy_set_header Host $host; | |
} | |
location /products { | |
# Route requests to the product-service | |
proxy_pass http://product_service; | |
proxy_set_header Host $host; | |
} | |
location /orders { | |
# Route requests to the order-service | |
proxy_pass http://order_service; | |
proxy_set_header Host $host; | |
} | |
# Add any other API routes and their corresponding services here | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment