0

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!

Matthew Gall
  • 355
  • 1
  • 8

1 Answers1

2

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. :)

kworr
  • 1,055
  • 8
  • 14
  • 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