On 6 Jun 2014 08:49, "basti" <black.flederm...@arcor.de> wrote: > > Hello, > > I try to block wildcard sub domains as follows: > > > # block wildcard > server { > server_name ~^(.*)\.example\.com$ ; > root /usr/share/nginx/www; > error_page 403 /index.html; > allow 127.0.0.1; > deny all; > access_log off; > log_not_found off; > }
I'm sure there's a precedence rule that'll explain this but I don't have it to hand. However, have you considered merely telling that server{} to listen only on 127.0.0.1? You may also wish to look at the server_name documentation for the shorthand of "*.foo.com" instead of the regex you're using. Finally, if your aim is just to deny requests for hosts you haven't explicitly configured elsewhere in nginx's config file, I find the following to be a useful catchall. Use it alongside well-defined server_names in other server blocks. server { listen 80 default_server; server_name _; location / { return 404; } } HTH, J
_______________________________________________ nginx mailing list nginx@nginx.org http://mailman.nginx.org/mailman/listinfo/nginx