Skip to content

Commit

Permalink
Deploy: nginx docker 복구
Browse files Browse the repository at this point in the history
  • Loading branch information
newbission committed Jun 11, 2024
1 parent c5a7a1a commit 9810e06
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 6 deletions.
26 changes: 23 additions & 3 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ version: '3'

services:
ndd:
container_name: 'ndd-server'
container_name: 'django'
build:
context: .
ports:
Expand All @@ -11,7 +11,7 @@ services:
volumes:
- ./app:/ndd/app
- ./log/gunicorn:/log
- ./statics:/ndd/statics
- static-data:/ndd/statics
environment:
- DB_HOST=db
- DB_NAME=${DB_NAME}
Expand All @@ -29,7 +29,7 @@ services:
- db

db:
container_name: 'ndd-db'
container_name: 'postgres'
image: postgres:latest
restart: always
volumes:
Expand All @@ -41,5 +41,25 @@ services:
ports:
- 5432:5432

proxy:
container_name: 'nginx'
build:
context: ./proxy
restart: always
depends_on:
- ndd
ports:
- 80:80
- 443:443
volumes:
- /etc/letsencrypt:/etc/letsencrypt
- ./nginx/var/lib/letsencrypt:/var/lib/letsencrypt
- ./app:/ndd/app
- ./log/nginx:/log
- static-data:/ndd/statics
environment:
- TZ=Asia/Seoul

volumes:
postgres-data:
static-data:
2 changes: 1 addition & 1 deletion proxy/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM nginx:latest
COPY nginx.conf /etc/nginx/nginx.conf
COPY ndd.conf /etc/nginx/sites-enabled/
COPY nddapp.duckdns.org.conf /etc/nginx/conf.d/
CMD ["nginx", "-g", "daemon off;"]
4 changes: 2 additions & 2 deletions proxy/nddapp.duckdns.org.conf
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@ server {
proxy_pass https://ndd-project.vercel.app/;
}

location = /api {
location /api {
proxy_pass http://ndd:8000;
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;
}

location = /static {
location /static {
alias /ndd/statics/;
}
}

0 comments on commit 9810e06

Please sign in to comment.