How to configure nginx to accept all subdomain?

Rodrigo asked:

This is part of nginx.conf:

server {
   listen 80 default deferred; # for Linux
   server_name *.server.com.br;
   client_max_body_size 4G;

   # omitted
}

I want to accept without redirecting:

www.server.com.br
server.com.br
google.server.com.br
facebook.server.com.br

How to configure server block?

My answer:


The documentation shows how to do this:

server_name .server.com.br;

View the full question and answer on Server Fault.

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.