Created
June 20, 2024 05:50
-
-
Save abhi-io/80dffb3db427835ebfc7ed77a897cdfa to your computer and use it in GitHub Desktop.
nginx conf - ip server
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 an upstream block for backend services | |
upstream api_backend { | |
server localhost:6565; | |
} | |
# HTTP server block to handle requests | |
server { | |
listen 80; | |
server_name ; | |
# Frontend Docker container | |
location / { | |
proxy_pass http://localhost:3000; | |
# Optional: Add additional proxy settings if needed | |
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-Proto $scheme; | |
} | |
# API Docker container | |
location /api/ { | |
proxy_pass http://api_backend/api/ ; | |
# Optional: Add additional proxy settings if needed | |
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-Proto $scheme; | |
} | |
# Optional: If you have other static files to serve | |
# location /static/ { | |
# alias /path/to/your/static/files; | |
# # Optional: Add more directives as needed | |
# } | |
# Optional: If you have other services or fallback | |
# location /other/ { | |
# proxy_pass http://other_service/; | |
# # Optional: Add more directives as needed | |
# } | |
# Optional: Custom error handling | |
# error_page 404 /404.html; | |
# location = /404.html { | |
# root /path/to/your/error/files; | |
# internal; | |
# } | |
# Additional server settings can go here | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment