From 46fdd5b9b7f3b7bff7d4da500630dce35af1488b Mon Sep 17 00:00:00 2001 From: 82everywin <82everywin@gmail.com> Date: Sun, 2 Mar 2025 15:10:45 +0900 Subject: [PATCH] =?UTF-8?q?fix:=20=EB=8F=84=EC=BB=A4=EB=82=B4=20nginx=20?= =?UTF-8?q?=EC=82=AD=EC=A0=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docker-compose.yml | 15 ------------- nginx/nginx.conf | 54 ---------------------------------------------- 2 files changed, 69 deletions(-) delete mode 100644 nginx/nginx.conf diff --git a/docker-compose.yml b/docker-compose.yml index 02eb5bf..2daaedf 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -18,21 +18,6 @@ services: networks: - app-network - nginx: - image: nginx:latest - container_name: book-mile-nginx - ports: - - "80:80" - - "443:443" - volumes: - - ./nginx/nginx.conf:/etc/nginx/nginx.conf:ro # Nginx 설정 파일을 컨테이너에 마운트 - - ./nginx/ssl:/etc/letsencrypt/live/bookmile.site # SSL 인증서 마운트 - depends_on: - - application - networks: - - app-network - restart: always # 컨테이너가 종료되면 자동 재시작 - redis: image: redis:latest container_name: book-mile-redis diff --git a/nginx/nginx.conf b/nginx/nginx.conf deleted file mode 100644 index bf03642..0000000 --- a/nginx/nginx.conf +++ /dev/null @@ -1,54 +0,0 @@ -# HTTP에서 HTTPS로 리다이렉트 -server { - listen 80; - server_name bookmile.site www.bookmile.site; - - location /.well-known/acme-challenge/ { - root /var/www/certbot; - allow all; - } - - location / { - return 301 https://$host$request_uri; - } -} - -# HTTPS 설정 -server { - listen 443 ssl; - server_name bookmile.site www.bookmile.site; - - # SSL 인증서 경로 (Let's Encrypt 인증서) - ssl_certificate /etc/letsencrypt/live/bookmile.site/fullchain.pem; - ssl_certificate_key /etc/letsencrypt/live/bookmile.site/privkey.pem; - - # SSL 설정 강화 - ssl_protocols TLSv1.2 TLSv1.3; - ssl_ciphers HIGH:!aNULL:!MD5; - - # 애플리케이션 프록시 - location / { - proxy_pass http://application:8080; # 'application'은 docker-compose.yml에서 정의된 서비스 이름 - proxy_set_header Host $host; - proxy_set_header X-Real-IP $remote_addr; - proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; - - # CORS 설정 추가 - add_header 'Access-Control-Allow-Origin' 'https://bookmile.site' always; - add_header 'Access-Control-Allow-Credentials' 'true' always; - add_header 'Access-Control-Allow-Methods' 'GET, POST, PUT, DELETE, OPTIONS' always; - add_header 'Access-Control-Allow-Headers' 'Authorization, Content-Type, X-Requested-With' always; - } - - # Preflight 요청 처리 (OPTIONS) - location /api/ { - if ($request_method = 'OPTIONS') { - add_header 'Access-Control-Allow-Origin' 'https://bookmile.site'; - add_header 'Access-Control-Allow-Credentials' 'true'; - add_header 'Access-Control-Allow-Methods' 'GET, POST, PUT, DELETE, OPTIONS'; - add_header 'Access-Control-Allow-Headers' 'Authorization, Content-Type, X-Requested-With'; - return 204; - } - proxy_pass http://application:8080; - } -}