Page loading is very slow with ngx_http_auth_pam_module

Cumali Ceylan cumali.ceylan at
Mon May 29 07:36:29 UTC 2017

I was debugging nginx with pam configuration for a while. I built libpam 
with debug option and investigated logs of it in order to find out 
overhead of it. My system is an embedded Linux system with NXP/Freescale 
Vybrid VF6x processor. if a http request takes a 100-200 ms from the 
browser side without authentication, when i enable the pam with, it takes 1500-1700ms from the browser side. This slow 
working doesn't seem a classical fail delay problem that is well 
explained in so many forums.

PAM module of the nginx is sequentially calling pam_start, 
pam_authenticate, pam_acct_mgmt and pam_end functions. The pam_start 
function is doing the same configuration jobs at each http request and 
it causing some overhead. I tried to patch module and called pam_start 
for once during first http request and set user name and password with 
pam_set_item function but it doesn't saved enough duration. In addition, 
other functions are generating so many logs and doing so many jobs at 
each request.

In my opinion, authenticating at each http request and my slow machine 
are collectively causing this problem so that I gave up to use this 
module with nginx. If you know any other thing and have an idea about 
this, you can still write here. I will follow this thread but for now, i 
am planning to write a nginx module in order to provide basic pam 

Kind regards,

Cumali Ceylan

On 05/24/2017 09:54 AM, Cumali Ceylan wrote:
> I built libpam --with-debug configuration and collect logs while 
> logging with nginx and saw that libpam opens configurations and parses 
> them at each single request. I think this is the problem. Is there 
> anyone how to solve this issue ?
> Kind regards,
> Cumali Ceylan
> On 05/12/2017 05:22 PM, Cumali Ceylan wrote:
>> No it seems good to me. In addition, I tried to install nscd upon a 
>> suggestion but it didn't make a difference. I can see that the nscd 
>> cahces the user in its log file.
>> On 05/12/2017 05:13 PM, Jared Mulder wrote:
>>> are your shell logins slow as well? sometimes PAM behaves like this.
>>> Live long and prosper,
>>> Christ-Jan Wijtmans
>>> On Thu, May 11, 2017 at 1:48 PM, Cumali Ceylan 
>>> <cumali.ceylan at> wrote:
>>>> Hello,
>>>> I built nginx with ngx_http_auth_pam_module, setup linux-pam for local
>>>> passwords with pam_unix module and setup nginx to use this pam config.
>>>> Linux-pam config file is below:
>>>> auth        sufficient nullok
>>>> account   required
>>>> When I did this, loading of page is very slow. If i remove this 
>>>> config and
>>>> simply setup nginx for basic authentication (with auth_basic), page 
>>>> loading
>>>> is again turns to normal.
>>>> Is there anyone who observed same thing with me ? Any information 
>>>> will be
>>>> helpful.
>>>> Kind regards,
>>>> Cumali Ceylan
>>>> _______________________________________________
>>>> nginx mailing list
>>>> nginx at
>>> _______________________________________________
>>> nginx mailing list
>>> nginx at

More information about the nginx mailing list