diff --git a/nginx/.gitignore b/nginx/.gitignore index 95e247d..a50cecb 100644 --- a/nginx/.gitignore +++ b/nginx/.gitignore @@ -1,2 +1,3 @@ snippets/managed-by-Certbot.conf -snippets/private-ip.conf \ No newline at end of file +snippets/private-ip.conf +snippets/auth-value.conf \ No newline at end of file diff --git a/nginx/sites-available/default b/nginx/sites-available/default index 4de8504..dc6787a 100644 --- a/nginx/sites-available/default +++ b/nginx/sites-available/default @@ -109,6 +109,18 @@ server { # managed by Certbot include /etc/nginx/snippets/managed-by-Certbot.conf; + include /etc/nginx/snippets/auth-value.conf; + + set $auth_allowed 0; + + if ($http_auth = $auth_secret_value) { + set $auth_allowed 1; + } + + if ($auth_allowed = 0) { + return 403; # 인증 실패 시 403 Forbidden 반환 + } + location /count { content_by_lua_block { -- access.log의 라인 수를 세어 successCount로 사용