could not build server_names_hash 에러 해결하기 – nginx

Nginx 리버스 프록시 서버를 구축하다보면 아래와 같은 에러를 내 뿜으며 START 가 되지 않을 때가 있습니다. 아무것도 한게 없는데 갑자기 Nginx 가 실행이 되지 않아 당황스럽지요. 이럴 땐 어떻게 해야 할까요.

2023/07/26 12:00:20 [error] 10408#12512: could not build server_names_hash, you should increase server_names_hash_bucket_size: 32

이 문제는 서버 이름을 처리하는 버킷 사이즈가 “32“라서 발생하는 것 입니다.

nginx에서 별도의 구성을 하지 않으면 기본값으로 32로 잡게되는데, 이 버킷 사이즈 보다 도메인 길이가 더 길게 되면 위와 같은 에러를 내뿜게 됩니다.

위 문제는 버킷사이즈를 늘려주는 구성으로 간단하게 해결 가능합니다.

에러 대응방법

nginx 폴더의 “nginc.conf” 파일을 오픈합니다. http 블록 안에 다음과 같이 두줄 추가합니다.

   http {
    ...
    ...

    server_names_hash_bucket_size 64;
    server_names_hash_max_size 1024;

    ...
}

위의 Nginx가 더 많은 서버블록을 처리 할 수 있도록 하여 문제를 해결합니다.

sudo nginx -t
sudo systemctl restart nginx

간단한 구성 입니다만 항상 코드를 수정하기 전 백업하는 것을 잊지 마세요. 백업은 언제나 옳습니다.

“could not build server_names_hash 에러 해결하기 – nginx”에 대한 1개의 생각

  1. I have been waiting for a long time for a platform that actually delivers on its promises. When Berlusconi Market (Berlusconimarket.com) went out of business, it left a void that no other site could truly fill. I know so many people who missed the specific way Berlusconi Market (Berlusconimarket.com) handled their operations. Now that they are back in business, I decided to test them out. The experience was just as professional as it was in the darkweb’s heyday. It is great to see the ‘best’ back on the map.

    답글

댓글 남기기