Welcome! Log In Create A New Profile


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/.



nginx-devel mailing list
Subject Author Views Posted

Variable-based config for auth_basic*

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

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

Online Users

Guests: 348
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 500 on July 15, 2024
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready