Can I customize authentication wtih nginx?

view full story

http://serverfault.com – I have a private network with many servers and web based services running on it. There is no application level authentication. I would like to expose many of the servers to the internet, but I want to proxy it behind nginx with nginx providing authentication. HttpAuthBasicModule is not sufficient, I would like to use scrypt for password digests, rate limit logins, and log the login attempts. I am formidable with Python, but I am lost with C. Any advise? (HowTos)