Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I have nginx installed, and I want to use the built-in auth-basic module to authenticate on 2 different folders. Each folder should have its own user & password lists. For this i created 2 locations in the nginx config, and specified auth_basic_user_file for each of the defined locations.

Ex: /torrents/ is a proxy for a local install of transmission, and /admin/ is an administration interface developed by me.

The problem is that if i authenticate in one location it will log me out from the other location.

share|improve this question

1 Answer 1

Using chromium and the following nginx configuration, I get a basic auth prompt the first time I visit each location, but after that, I can switch between them freely.

    location /torrents/ {
        auth_basic "transmission";
        auth_basic_user_file /tmp/transmission;
        alias /tmp/transmission/ ;
        autoindex on;
    }
    location /admin/ {
        auth_basic "administration";
        auth_basic_user_file /tmp/administration;
        alias /tmp/administration/ ;
        autoindex on;
    }

Note: tested on nginx/1.4.4

share|improve this answer
    
you are right, on this simplified case it works, it might have something to do with proxy-ing data from transmission, or with the way transmission does its auth... I'll keep investigating –  quamis Dec 31 '13 at 8:24

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.