Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Upon my server, I am running Webalizer on a few of my client's websites (and associated log files of access). Now this process is fine, and the log files are generated correctly and stored.

What I am trying to set up nginx to do, is for a user to access a domain (logging.{hostname of my server}) and to be presented with the usual htpasswd powered login box. The user then enters the username and password that I have given them, and based on which user logs in, I would like them to be redirected to a relevant folder I specify.

I've done a load of research and I can't figure if this is possible and if so, how to achieve it. Setting up individual logins for each folder seems un-necessary.

Thanks in advance!

share|improve this question
up vote 1 down vote accepted

You can tail your configuration to $remote_user variable:

location /webalizer {
 alias /path/to/logs/$remote_user/;
 # your auth options here

Be carefull with your usernames though. :)

share|improve this answer
I just tried this and it works perfectly! Only small issue, you need a trailing forward slash at the end of the alias directive. But so far, so good! – Matthew Gall Jun 12 '12 at 17:01

Your Answer


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.