title: Nginx gives an Internal Server Error 500 after I have configured basic auth
body: <p>I am trying to do basic auth on Nginx. I have version 1.9.3 up and running on Ubuntu 14.04 and it works fine with a simple html file. </p>
  
  <p>Here is the html file:</p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html lang="en"&gt;
  &lt;head&gt;
    &lt;meta charset="UTF-8"&gt;
    &lt;title&gt;&lt;/title&gt;
  &lt;/head&gt;
  &lt;body&gt;
    "Some shoddy text"
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>And here is my nginx.conf file:</p>
  
  <pre><code>user  nginx;
  worker_processes  1;
  
  error_log  /var/log/nginx/error.log warn;
  pid        /var/run/nginx.pid;
  
  
  events {
      worker_connections  1024;
  }
  
  
  http {
      include       /etc/nginx/mime.types;
      default_type  application/octet-stream;
  
      log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
                        '$status $body_bytes_sent "$http_referer" '
                        '"$http_user_agent" "$http_x_forwarded_for"';
  
      access_log  /var/log/nginx/access.log  main;
  
      sendfile        on;
      #tcp_nopush     on;
  
      keepalive_timeout  65;
  
      #gzip  on;
  
      include /etc/nginx/conf.d/*.conf;
      server {
          listen 80;
          server_name 192.168.1.30;
          location / {
              root /www;
              index index.html;
              auth_basic "Restricted";
              auth_basic_user_file /etc/users;
          }
      }
  }
  </code></pre>
  
  <p>I used htpasswd to create two users in the "users" file under /etc (username "calvin" password "Calvin", and username "hobbes" password "Hobbes"). It's encrypted by looks like this:</p>
  
  <pre><code>calvin:$apr1$Q8LGMfGw$RbO.cG4R1riIfERU/175q0
  hobbes:$apr1$M9KoUUhh$ayGd8bqqlN989ghWdTP4r/
  </code></pre>
  
  <p>All files belong to root:root. The server IP address is 192.168.1.30 and I am referencing that directly in the conf file. </p>
  
  <p>It all works fine if I comment out the two auth lines and restart nginx, but if I uncomment them, then I do indeed get the username and password prompts when I try to load the site, but immediately thereafter get an Error 500 Internal Server error which seems to persist and I have to restart nginx. </p>
  
  <p>Anybody can see what I'm doing wrong here? I had the same behaviour on the standard Ubuntu 14.04 apt-get version of Nginx (1.4.something) so I don't think it's the nginx version. </p>