Welcome! Log In Create A New Profile

Advanced

Variable-based config for auth_basic*

Sebastian J. Bronner
August 21, 2010 10:12PM
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


_______________________________________________
nginx-devel mailing list
nginx-devel@nginx.org
http://nginx.org/mailman/listinfo/nginx-devel
Subject Author Views Posted

Variable-based config for auth_basic*

Sebastian J. Bronner 3016 August 21, 2010 10:12PM



Sorry, you do not have permission to post/reply in this forum.

Online Users

Guests: 293
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready