Solved nginx crashes since digest authentication is set

Hello,

my brand new nginx worked great up to the point when I have enabled digest authentication to the /munin location.

I have re-created the digest file with htdigest -c /usr/local/etc/nginx/htdigest private myusername, but on every web access nginx crashes. After logging in, I get this in the logs:
Code:
2020/01/30 16:24:18 [info] 14776#100094: *16 sucessful auth, not tracking, client: 2a07:59e6:ee02:ffff:ffff:ffff:a3dc:69e7, server: munin.example.org, request: "GET /munin/ HTTP/2.0", host: "munin.example.org"
2020/01/30 16:24:18 [alert] 14482#100183: worker process 14776 exited on signal 6

/usr/local/etc/nginx/htdigest is owned by user www and group www, I had chmod'ed it to 0660 before I tried.

Nginx config snippet:
Code:
        location /munin/ {
            alias /usr/local/www/munin/;
            auth_digest 'private';
            auth_digest_user_file '/usr/local/etc/nginx/htdigest';
        }
 
I had chmod'ed it to 0660 before I tried.
Don't give the www user/group write access to this file.

On an unrelated note, don't put a slash at the end of your directories:
Code:
location /munin {
            alias /usr/local/www/munin;
            ....
}
With the added slash this location is only accessible from http://myserver/munin/ and not from http://myserver/munin, without the slash both forms will work correctly.
 
  • Like
Reactions: a6h
On another unrelated note, put a slash at the end of your directories in HTML files to conserve one round-trip to the server.
  1. If the slash is missing in the HTML request, server checks to find out if the request is a directory or a file.
  2. If it is a directory, server response to browser to send the request again with a slash.
I can not think of any references off the top of my head, hence it's a good idea to confirm it, with a packet analyzer.
 
On another unrelated note, put a slash at the end of your directories in HTML files to conserve one round-trip to the server.
  1. If the slash is missing in the HTML request, server checks to find out if the request is a directory or a file.
  2. If it is a directory, server response to browser to send the request again with a slash.
I can not think of any references off the top of my head, hence it's a good idea to confirm it, with a packet analyzer.
Yep. When typing the URL in the addressbar the redirect is convenient, for URL references (href) the redirect adds additional requests which makes it load slightly slower.
 
  • Thanks
Reactions: a6h
Back
Top