mirror of
https://github.com/seanmorley15/AdventureLog.git
synced 2025-07-21 22:09:36 +02:00
Update NGINX configuration and docker-compose for improved service references
This commit is contained in:
parent
6cf17ce56e
commit
ae3c43f7c8
2 changed files with 7 additions and 6 deletions
|
@ -1,4 +1,5 @@
|
||||||
worker_processes 1;
|
worker_processes 1;
|
||||||
|
|
||||||
events {
|
events {
|
||||||
worker_connections 1024;
|
worker_connections 1024;
|
||||||
}
|
}
|
||||||
|
@ -12,23 +13,23 @@ http {
|
||||||
|
|
||||||
client_max_body_size 100M;
|
client_max_body_size 100M;
|
||||||
|
|
||||||
|
# The backend is running in the same container, so reference localhost
|
||||||
upstream django {
|
upstream django {
|
||||||
server server:8000; # Use the internal Docker networking
|
server 127.0.0.1:8000; # Use localhost to point to Gunicorn running internally
|
||||||
}
|
}
|
||||||
|
|
||||||
server {
|
server {
|
||||||
listen 80; # NGINX always listens on port 80 inside the container
|
listen 80; # NGINX listens on port 80 inside the container
|
||||||
server_name localhost;
|
server_name localhost;
|
||||||
|
|
||||||
location / {
|
location / {
|
||||||
proxy_pass http://server:8000; # Explicitly forward to Django service
|
proxy_pass http://django; # Forward to the upstream block
|
||||||
proxy_set_header Host $host;
|
proxy_set_header Host $host;
|
||||||
proxy_set_header X-Real-IP $remote_addr;
|
proxy_set_header X-Real-IP $remote_addr;
|
||||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||||
proxy_set_header X-Forwarded-Proto $scheme;
|
proxy_set_header X-Forwarded-Proto $scheme;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
location /static/ {
|
location /static/ {
|
||||||
alias /code/staticfiles/; # Serve static files directly
|
alias /code/staticfiles/; # Serve static files directly
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,7 @@ services:
|
||||||
container_name: adventurelog-frontend
|
container_name: adventurelog-frontend
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
environment:
|
environment:
|
||||||
- PUBLIC_SERVER_URL=http://server:8000 # MOST DOCKER USERS WILL NOT NEED TO CHANGE THIS EVER EVEN IF YOU CHANGE THE OUTWARD PORT
|
- PUBLIC_SERVER_URL=http://server:8000 # Should be the service name of the backend with port 8000, even if you change the port in the backend service
|
||||||
- ORIGIN=http://localhost:8015
|
- ORIGIN=http://localhost:8015
|
||||||
- BODY_SIZE_LIMIT=Infinity
|
- BODY_SIZE_LIMIT=Infinity
|
||||||
ports:
|
ports:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue