I found this question How many server blocks can I add in Nginx Conf
But I don't think adjust server_names_hash_bucket_size and server_names_hash_max_size is the answer.
Because the explanation from Nginx is this:
If a large number of server names are defined, or unusually long server names are defined, tuning the server_names_hash_max_size and server_names_hash_bucket_size directives at the http level may become necessary.
Which means changing this 2 values will only solve the issue of having large number of server names but not the sever blocks.
In my case, I will have to create 10000 of server block and each block has one server name.
Anyone knows if there is a maximum number on how many server blocks that I can create?