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
2 changes: 1 addition & 1 deletion .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ jobs:
# ๋ฆฌํฌ์ง€ํ† ๋ฆฌ ์ด๋ฆ„์„ ์†Œ๋ฌธ์ž๋กœ ๋ณ€ํ™˜
RAW_IMAGE_NAME="${{ github.repository }}"
echo "GITHUB_REPOSITORY=${RAW_IMAGE_NAME,,}" >> .env
chmod 644 .env
chmod 600 .env

# ์ƒ์„ฑ๋œ .env์™€ ํ•„์š”ํ•œ ์†Œ์Šค๋“ค์„(Sparse Checkoutํ•œ๊ฒƒ) ์‹คํ–‰ ์œ„์น˜๋กœ ๋ณต์‚ฌํ•œ๋‹ค.
- name: Sync files to app directory
Expand Down
15 changes: 13 additions & 2 deletions nginx/conf.d/default.conf
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ server {
ssl_certificate /etc/letsencrypt/live/api.ssambee.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/api.ssambee.com/privkey.pem;

# Rate Limit ์ƒํƒœ ์ฝ”๋“œ๋ณ€๊ฒฝ (๊ธฐ๋ณธ 503 -> 429) - 429๋Š” Too Many Requests
limit_req_status 429;
limit_req_log_level warn; # ์—๋Ÿฌ ๋กœ๊ทธ์— ๊ธฐ๋ก๋˜์–ด Fail2ban์ด ๊ฐ์ง€ํ•  ์ˆ˜ ์žˆ๊ฒŒ

# ํด๋ผ์ด์–ธํŠธ ์ตœ๋Œ€ ์—…๋กœ๋“œ ํฌ๊ธฐ
client_max_body_size 100M;

Expand All @@ -30,6 +34,9 @@ server {
return 301 https://www.ssambee.com;
}

# ์ˆœ๊ฐ„์ ์œผ๋กœ ๋“ค์–ด์˜ค๋Š” 50๊ฐœ ์š”์ฒญ๊นŒ์ง€๋Š” ๋Œ€๊ธฐ์—ด๋กœ - ๋Œ€๊ธฐ์—ด์— ์žˆ๋Š” ์š”์ฒญ๋„ ์ง€์—ฐ ์—†์ด ์ฆ‰์‹œ
limit_req zone=api_limit burst=50 nodelay;

proxy_pass http://backend;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
Expand All @@ -40,8 +47,9 @@ server {
proxy_set_header X-Forwarded-Proto $scheme;
proxy_cache_bypass $http_upgrade;

# ํƒ€์ž„์•„์›ƒ ์„ค์ •
# Cookie ์„ค์ • ์œ ์ง€
proxy_cookie_domain api.ssambee.com .ssambee.com;
# ํƒ€์ž„์•„์›ƒ ์„ค์ •
proxy_connect_timeout 60s;
proxy_send_timeout 60s;
proxy_read_timeout 60s;
Expand All @@ -53,12 +61,15 @@ server {
access_log off;
}

# API ์—”๋“œํฌ์ธํŠธ (ํ•„์š”์‹œ)
# API ์—”๋“œํฌ์ธํŠธ
location /api {
if ($http_accept ~* "text/html") {
return 301 https://www.ssambee.com;
}

# api ์š”์ฒญ: ๋” ์—„๊ฒฉํ•œ burst๋ฅผ ์ ์šฉ
limit_req zone=api_limit burst=30 nodelay;

proxy_pass http://backend;
proxy_http_version 1.1;
proxy_set_header Host $host;
Expand Down