nginx http auth module query
António P. P. Almeida
appa at perusio.net
Fri Feb 17 04:00:52 UTC 2012
On 17 Fev 2012 03h49 WET, nginx-forum at nginx.us wrote:
> Hi,
>
> I have the following use case -
>
> I have nginx running at port 80 and a php hiphop server running at
> 4247. I want to achieve the following configuration -
>
> Whenever a request is received at nginx port 80, it should be sent
> to some auth_url (say auth.php) and if it is authorized then it
> should be forwarded/proxied to hiphop server running at 4247. If not
> some error page should be thrown.
>
> I was looking through ngx_http_auth_request_module and other inbuilt
> modules. But I have the following doubts -
>
> 1) What could the possible config look like where both
> ngx_http_auth_request_module and proxy_pass are included?
> 2) For my auth.php, what should it return true/false or something
> else?
>
> Thanks,
> Karan
Schematically:
location /index.php {
error_page 401 403 /not_authorized.html;
auth_request /auth.php;
proxy_pass http://hiphop:4247;
}
location = /auth.php {
# FCGI stuff or whatever PHP CGI you're using.
# auth.php should return 401 or 403 when auth process fails, return
# 200 otherwise
}
--- appa
More information about the nginx
mailing list