使用python进行nginx http身份验证

and*_*ref 5 python apache authentication nginx

我正在从Apache2迁移到NGinX,我想通过python脚本进行身份验证.Apache2的工作配置是:


WSGIScriptAlias /hg $SCRIPT_DIR/hgwebdir.wsgi
WSGIPythonPath $SCRIPT_DIR
<Location /hg>
    AuthType Basic
    AuthName "Mercurial"
    AuthBasicProvider wsgi
    WSGIAuthUserScript $SCRIPT_DIR/authentication.py
    Require valid-user
</Location>
Run Code Online (Sandbox Code Playgroud)

nginx中的等效配置是什么?