-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f3027ff
commit a0a6252
Showing
3 changed files
with
39 additions
and
0 deletions.
There are no files selected for viewing
Empty file.
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# Base image for nginx | ||
FROM nginx:latest | ||
|
||
# Remove the default nginx config file | ||
RUN rm /etc/nginx/conf.d/default.conf | ||
|
||
# Copy the custom nginx configuration file | ||
COPY nginx.conf /etc/nginx/conf.d/ | ||
|
||
# Expose port 80 | ||
EXPOSE 80 | ||
|
||
# Start Nginx | ||
CMD ["nginx", "-g", "daemon off;"] |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# Load Balancer Configuration | ||
http { | ||
upstream django_backend { | ||
server moodify-emotion-music-app.onrender.com; # Default port: 10000 | ||
server moodify-emotion-music-app.onrender.com:8000; | ||
server moodify-emotion-music-app.onrender.com:8001; | ||
server moodify-emotion-music-app.onrender.com:8002; | ||
} | ||
|
||
# Server block for load balancing | ||
server { | ||
listen 80; | ||
|
||
# Define the root for the requests, forward to upstream | ||
location / { | ||
proxy_pass http://django_backend; | ||
|
||
# Set proxy headers | ||
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; | ||
} | ||
} | ||
} |