Q:

how to "allow from hostname" in nginx config

I'm currently doing this in my nginx.conf:
allow 1.2.3.4;
deny;

What I'd really like to do is this:
allow my.domain.name;
deny;

I.e., I want nginx to do an A record lookup on my.domain.name at the time of the request, and if it matches the IP that the request is coming from, then allow it.  I don't see any built-in mechanism to do this however.  Anybody have a native way to do this before I start coding something custom? 

A:

ngx_http_rdns_module does what you need: http://wiki.nginx.org/HttpRdnsModule (https://github.com/flant/nginx-http-rdns)
Summary
This module allows to make a reverse DNS (rDNS) lookup for incoming connection and provides simple access control of incoming hostname by allow/deny rules (similar to HttpAccessModule allow/deny directives; regular expressions are supported).  Module works with the DNS server defined by the standard resolver directive. 
Example
location / {
    resolver 127.0.0.1;

    rdns_deny badone\.example\.com;

    if ($http_user_agent ~* FooAgent) {
        rdns on;
    }

    if ($rdns_hostname ~* (foo\.example\.com)) {
        set $myvar foo;
    }

    #...
}

A:

There is no such feature in official distribution of nginx.  Beacause it may heavily reduce performance. 
Third party modules http://wiki.nginx.org/3rdPartyModules also doesn't contain this feature.