Variable-based config for auth_basic*
    Sebastian J. Bronner 
    waschtl at sbronner.com
       
    Sun Aug 22 06:10:24 MSD 2010
    
    
  
Hi there,
if you liked my post about using variables for the specification of
SSL-certificates, you're going to love this one:
I have a basic-auth section in my SSL server configuration that I would
like to be able to use variables with, like so:
"""
server {
        listen                  443 default ssl;
        ssl_certificate         /etc/ssl/certs/server.cert;
        ssl_certificate_key     /etc/ssl/private/server.key;
        root /srv/www;
        location ~ /([^/]+)/private/ {
                auth_basic              "$1/private";
                auth_basic_user_file    /srv/www/passwd/$1;
        }
}
"""
This way my one configuration section can serve all of the /*/private
directories under /srv/www without ever needing to be changed. And each
user can administer his own password file in /srv/www/passwd/.
Opinions?
Cheers,
Sebastian
    
    
More information about the nginx-devel
mailing list