|
| 1 | +server { |
| 2 | + listen 80; |
| 3 | + server_name octodocs.com www.octodocs.com; |
| 4 | + |
| 5 | + # Certbot 인증용 경로 (최상단에 위치) |
| 6 | + location ^~ /.well-known/acme-challenge/ { |
| 7 | + root /var/www/certbot; |
| 8 | + try_files $uri =404; |
| 9 | + break; |
| 10 | + } |
| 11 | + |
| 12 | + # 나머지 모든 HTTP 트래픽은 HTTPS로 리다이렉트 |
| 13 | + location / { |
| 14 | + return 301 https://$server_name$request_uri; |
| 15 | + } |
| 16 | +} |
| 17 | + |
| 18 | +server { |
| 19 | + listen 443 ssl; |
| 20 | + server_name octodocs.com www.octodocs.com; |
| 21 | + |
| 22 | + # Let's Encrypt 인증서 경로 |
| 23 | + ssl_certificate /etc/letsencrypt/live/octodocs.com/fullchain.pem; |
| 24 | + ssl_certificate_key /etc/letsencrypt/live/octodocs.com/privkey.pem; |
| 25 | + |
| 26 | + # SSL 설정 |
| 27 | + ssl_protocols TLSv1.2 TLSv1.3; |
| 28 | + ssl_ciphers HIGH:!aNULL:!MD5; |
| 29 | + ssl_prefer_server_ciphers on; |
| 30 | + |
| 31 | + # 인증서가 없을 때 fallback |
| 32 | + ssl_trusted_certificate /etc/letsencrypt/live/octodocs.com/chain.pem; |
| 33 | + ssl_stapling on; |
| 34 | + ssl_stapling_verify on; |
| 35 | + |
| 36 | + # 에러 페이지 설정 |
| 37 | + error_page 497 https://$server_name$request_uri; |
| 38 | + |
| 39 | + # gzip 압축 설정 |
| 40 | + gzip on; |
| 41 | + gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript; |
| 42 | + |
| 43 | + # 프론트엔드 정적 파일 |
| 44 | + location / { |
| 45 | + root /usr/share/nginx/html; |
| 46 | + try_files $uri $uri/ /index.html; |
| 47 | + expires 30d; |
| 48 | + } |
| 49 | + |
| 50 | + # API 프록시 |
| 51 | + location /api { |
| 52 | + proxy_pass http://backend:3000; |
| 53 | + proxy_http_version 1.1; |
| 54 | + proxy_set_header Upgrade $http_upgrade; |
| 55 | + proxy_set_header Connection 'upgrade'; |
| 56 | + proxy_set_header Host $host; |
| 57 | + proxy_cache_bypass $http_upgrade; |
| 58 | + } |
| 59 | + |
| 60 | + # Socket.IO 프록시 (일반 웹소켓) |
| 61 | + location /socket.io { |
| 62 | + proxy_pass http://backend:1234; |
| 63 | + proxy_http_version 1.1; |
| 64 | + proxy_set_header Upgrade $http_upgrade; |
| 65 | + proxy_set_header Connection "Upgrade"; |
| 66 | + proxy_set_header Host $host; |
| 67 | + } |
| 68 | + |
| 69 | + # Y-Socket.IO 프록시 (YJS 웹소켓) |
| 70 | + location /flow-room { |
| 71 | + proxy_pass http://backend:1234; |
| 72 | + proxy_http_version 1.1; |
| 73 | + proxy_set_header Upgrade $http_upgrade; |
| 74 | + proxy_set_header Connection "Upgrade"; |
| 75 | + proxy_set_header Host $host; |
| 76 | + } |
| 77 | +} |
0 commit comments