basic auth for specific controller

Peter Premium lists at ruby-forum.com
Mon Oct 18 14:07:55 MSD 2010


Hi,

we would like to provide basic auth for specific rails controllers
(/stats ...) with nginx (and passenger).

We tried the following.

server {
  listen 80;
  server_name www.myapp.de;
  root /home/deployer/myapp/public;
  passenger_enabled on;
  rails_env production;

  ...

  location ~ ^/(admin|awstats|webalizer|stats) {
    auth_basic "Restricted";
    auth_basic_user_file /etc/nginx/basic.auth;
  }

  ...
}


This results in the following error:

2010/10/18 11:18:20 [error] 31331#0: *4 open()
"/home/deployer/myapp/public/stats" failed (2: No such file or
directory), client: xx.xx.xx.xx, server: www.myapp.de, request: "GET
/stats HTTP/1.1", host: "www.myapp.de"

Nginx responds with a 404 page.

It seems like the server tries to serve static files
(/home/deployer/myapp/public/stats).

Any ideas?


Thanks in advance!

Peter

-- 
Posted via http://www.ruby-forum.com/.



More information about the nginx mailing list