# Auth Digest in Nginx



## nx (Jul 26, 2012)

I've just setup nginx and testing the config file nginx.conf with:


```
nginx -t
```

is giving:


```
nginx: [emerg] unknown directive "auth_digest_user_file" in /usr/local/etc/nginx/nginx.conf:54
nginx: configuration file /usr/local/etc/nginx/nginx.conf test failed
```

I have the file in the directory with path pointing to it in nginx.conf as per the doc's:

http://wiki.nginx.org/HttpAuthDigestModule

and I've had no problem getting htdigest working in apache.

I've had to deinstall/reinstall nginx to add the auth_digest module, and when I make config - it's selected - so it appears to be installed.

This is what I have:


```
auth_digest_user_file /usr/local/www/passwd.digest;
        location /private{
        auth_digest 'These aren't the files you're looking for.';
        }
```

Any thoughts on why digest auth may not be working?


----------



## vermaden (Jul 26, 2012)

There are 4 ' in that line, there should be only 2, at the beginning and at the end, or at least backslash the inner ones like that:

`auth_digest 'These aren\'t the files you\'re looking for.';`

... or use 'longer' version:
`auth_digest 'These are not the files you are looking for.';`


----------



## quintessence (Jul 26, 2012)

Hello,

When installing nginx from ports you should build with auth digest support, i.e. mark HTTP_AUTH_DIGEST, because by default is not built.
Also from the page you followed it is written that:



> ngx_http_auth_digest - HTTP Digest Authentication support for Nginx.
> 
> This module is *not *distributed with the Nginx source.


----------



## nx (Jul 26, 2012)

Thanks vermaden, I tried that but it doesn't fix it.

Duh! Thanks quintessence... I don't know how I missed that.

```
nginx -V
```

doesn't show the auth_digest module... but it also doesn't show the rewrite module which I had to install for php, and before I reinstalled nginx with it, the config complained it was missing.
That's my excuse for missing the install instructions! 

I'll follow them now.

Thanks!


----------



## nx (Jul 26, 2012)

While your eyes are on the screen... 

would you mind looking at how I'm setting permissions for apache in this link:

http://forums.freebsd.org/showthread.php?t=33525

I'm hoping to do the same for nginx tonight - or better if I get some feedback.

Ty


----------

