Error setting up http authentication - 500 Internal Server Error

Igor Sysoev is at rambler-co.ru
Thu Feb 28 22:45:11 MSK 2008


On Thu, Feb 28, 2008 at 11:40:05AM -0800, Hari wrote:

> error is not being written to the error.log file.....
> 
> the permission for the error log file is set as below
> 
> demo at Himalaya:/etc/nginx/sites-available$ ls -al /var/log/nginx/error.log
> -rw-r--r-- 1 root root 416 Feb 25 15:55 /var/log/nginx/error.log
> 
> Here are the two process one is running as root and the second one as www-data.
> demo at Himalaya:/etc/nginx/sites-available$ ps aux | grep nginx
> root     10159  0.0  0.3  27436   808 ?        Ss   19:04   0:00
> nginx: master process /usr/sbin/nginx
> www-data 10160  0.0  0.5  27884  1564 ?        S    19:04   0:00
> nginx: worker process
> 
> 
> the root as write permision so i am not sure why erorrs are not being logged!!

Well, could yo build nginx with debug:

./configure --with-debug ...

and enable debug log in nginx.conf:

error_log  /var/log/nginx/error.log   debug;

Then do failed request and show the log. Note, that user/password will
be plain text encoded in base64, so use dummy user name and password.

> Hari
> 
> On Thu, Feb 28, 2008 at 11:22 AM, Igor Sysoev <is at rambler-co.ru> wrote:
> >
> > On Thu, Feb 28, 2008 at 11:09:08AM -0800, Hari wrote:
> >
> >  > Hi
> >  >
> >  > Here is the setup in the top level conf file
> >  >
> >  > ============================
> >  > user www-data;
> >  > worker_processes  1;
> >  >
> >  > error_log  /var/log/nginx/error.log;
> >  > pid        /var/run/nginx.pid;
> >  >
> >  > events {
> >  >     worker_connections  1024;
> >  > }
> >  >
> >  > http {
> >  >     include       /etc/nginx/mime.types;
> >  >     default_type  application/octet-stream;
> >  >
> >  >     access_log  /var/log/nginx/access.log;
> >  >     error_log   /var/log/nginx/error.log;
> >  >
> >  >     sendfile        on;
> >  >     #tcp_nopush     on;
> >  >
> >  >     #keepalive_timeout  0;
> >  >     keepalive_timeout  65;
> >  >     tcp_nodelay        on;
> >  >
> >  >     gzip  on;
> >  >
> >  >     include /etc/nginx/sites-enabled/*;
> >  >
> >  > }
> >  > ============================
> >  >
> >  > Here are the messages from the error.log file in /var/log/nginx/error.log
> >  >
> >  > demo at Himalaya:/etc/nginx$ cat /var/log/nginx/error.log
> >  > 2008/02/25 15:45:59 [error] 5813#0: *1 open()
> >  > "/var/www/nginx-default/favicon.ico" failed (2: No such file or
> >  > directory), client: 208.54.15.154, server: localhost, URL:
> >  > "/favicon.ico", host: "67.207.139.172"
> >  > 2008/02/25 15:55:51 [error] 5917#0: *1 open()
> >  > "/var/www/nginx-default/favicon.ico" failed (2: No such file or
> >  > directory), client: 208.54.15.154, server: localhost, URL:
> >  > "/favicon.ico", host: "67.207.139.172"
> >
> >  There should be an error line at the same time when you tried to access site.
> >
> >
> >
> >  >
> >  > Cheers
> >  > Hari
> >  >
> >  >
> >  > On Thu, Feb 28, 2008 at 10:50 AM, Igor Sysoev <is at rambler-co.ru> wrote:
> >  > > On Thu, Feb 28, 2008 at 10:43:06AM -0800, Hari wrote:
> >  > >
> >  > >  > I am using the instruction given at
> >  > >  > http://wiki.codemongers.com/NginxHttpAuthBasicModule#auth_basic
> >  > >  >
> >  > >  > When i access the site i get prompted for username and password.
> >  > >  > After i enter the username and password i get the error "500 Internal
> >  > >  > Server Error"
> >  > >
> >  > >  What is in error_log ?
> >  > >
> >  > >
> >  > >
> >  > >  > When i have the following two lines commented out i do not get any error.
> >  > >  > #    auth_basic "osusu";
> >  > >  > #    auth_basic_user_file conf/passwd;
> >  > >  >
> >  > >  >
> >  > >  > What am i doing wrong?
> >  > >  >
> >  > >  > Here is the setup of my conf file
> >  > >  > ==========================
> >  > >  > upstream domain1 {
> >  > >  >  server 127.0.0.1:8000;
> >  > >  >  server 127.0.0.1:8001;
> >  > >  > }
> >  > >  >
> >  > >  > server {
> >  > >  >  listen   80;
> >  > >  >  server_name  www.osusu.com;
> >  > >  >  rewrite ^/(.*) http://domain.com permanent;
> >  > >  > }
> >  > >  >
> >  > >  >
> >  > >  > server {
> >  > >  >  listen   80;
> >  > >  >  server_name osusu.com;
> >  > >  >
> >  > >  >  access_log /home/demo/public_html/domain.com/shared/log/access.log;
> >  > >  >  error_log /home/demo/public_html/domain.com/shared/log/error.log;
> >  > >  >
> >  > >  >  root   /home/demo/public_html/domain.com/current/public/;
> >  > >  >  index  index.html;
> >  > >  >
> >  > >  >  location / {
> >  > >  >    auth_basic "osusu";
> >  > >  >    auth_basic_user_file conf/passwd;
> >  > >  >    proxy_set_header  X-Real-IP  $remote_addr;
> >  > >  >    proxy_set_header  X-Forwarded-For $proxy_add_x_forwarded_for;
> >  > >  >    proxy_set_header Host $http_host;
> >  > >  >    proxy_redirect false;
> >  > >  >
> >  > >  >    if (-f $request_filename/index.html) {
> >  > >  >      rewrite (.*) $1/index.html break;
> >  > >  >    }
> >  > >  >    if (-f $request_filename.html) {
> >  > >  >      rewrite (.*) $1.html break;
> >  > >  >    }
> >  > >  >    if (!-f $request_filename) {
> >  > >  >      proxy_pass http://domain1;
> >  > >  >      break;
> >  > >  >    }
> >  > >  >  }
> >  > >  > }
> >  > >  > =================
> >  > >  >
> >  > >  > I created the conf file using the utility htpasswd.
> >  > >  >
> >  > >  > Any help on this is greatly appretiated...
> >  > >  >
> >  > >  > --
> >  > >  > Hariharan Venkata
> >  > >  >
> >  > >
> >  > >  --
> >  > >  Igor Sysoev
> >  > >  http://sysoev.ru/en/
> >  > >
> >  > >
> >  >
> >  >
> >  >
> >  > --
> >  > Hariharan Venkata
> >  > Phone - 408-890-9738 (Cell)
> >  >
> >
> >  --
> >
> >
> > Igor Sysoev
> >  http://sysoev.ru/en/
> >
> >
> 
> 
> 
> -- 
> Hariharan Venkata
> Phone - 408-890-9738 (Cell)
> 

-- 
Igor Sysoev
http://sysoev.ru/en/





More information about the nginx mailing list