Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions pinhouse_docker/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,37 @@ services:
networks:
- backend-bridge

# Nginx Proxy
nginx: # nginx ์„œ๋น„์Šค ์ •์˜
image: nginx:latest # ์‚ฌ์šฉํ•  Docker ์ด๋ฏธ์ง€
container_name: pinhouse-nginx
volumes:
- ./nginx/nginx.conf:/etc/nginx/nginx.conf
- ./data/certbot/conf:/etc/letsencrypt
- ./data/certbot/www:/var/www/certbot
ports:
- 80:80
- 443:443
depends_on:
- spring
networks:
- backend-bridge
command: '/bin/sh -c ''while :; do sleep 6h & wait $${!}; nginx -s reload; done & nginx -g "daemon off;"'''

certbot:
image: certbot/certbot
container_name: pinhouse-certbot
restart: unless-stopped
volumes:
- ./data/certbot/conf:/etc/letsencrypt
- ./data/certbot/www:/var/www/certbot
depends_on:
- nginx
networks:
- backend-bridge
entrypoint: "/bin/sh -c 'trap exit TERM; while :; do certbot renew; sleep 12h & wait $${!}; done;'"


networks:
backend-bridge:
driver: bridge
39 changes: 39 additions & 0 deletions pinhouse_docker/nginx/nginx.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
events {
worker_connections 1024;
}

http {
server {
listen 80;
server_name api.pinhouse.cloud;

# Certbot ์ธ์ฆ์„ ์œ„ํ•œ ๊ฒฝ๋กœ
location /.well-known/acme-challenge/ {
allow all;
root /var/www/certbot;
}

# HTTP ์š”์ฒญ์€ HTTPS๋กœ ๋ฆฌ๋””๋ ‰์…˜
location / {
return 301 https://$host$request_uri;
}
}

server {
listen 443 ssl;
server_name api.pinhouse.cloud;

# SSL ์ธ์ฆ์„œ ๊ฒฝ๋กœ
ssl_certificate /etc/letsencrypt/live/api.pinhouse.cloud-0001/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/api.pinhouse.cloud-0001/privkey.pem;
include /etc/letsencrypt/options-ssl-nginx.conf;
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem;

location / {
proxy_pass http://pinhouse-app:8080;
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}
}
Loading