Rails 3.2 Nginx Unicorn Basic Authentification -


i trying basic authentification work rails 3.2 nginx , unicorn

the configuration works hosting site. used rails basic authentification in controller have many problems while testing. .htpasswd file working restrict access static site.

in location config tried

location / location /home/deployer/apps/rails/current/public location /home/deployer/apps/rails/current/ 

any ideas?

this config:

upstream unicorn {   server unix:/tmp/unicorn.blog.sock fail_timeout=0; }  server {   listen 80 default deferred;   server_name railsserver;   root /home/deployer/apps/rails/current/public;    location / {     auth_basic "restricted";     auth_basic_user_file /var/www/prototyp/.htpasswd;   }    location ^~ /assets/ {     gzip_static on;     expires max;     add_header cache-control public;   }    try_files $uri/index.html $uri @unicorn;   location @unicorn {     proxy_set_header x-forwarded-for $proxy_add_x_forwarded_for;     proxy_set_header host $http_host;     proxy_redirect off;     proxy_pass http://unicorn;   }    error_page 500 502 503 504 /500.html;   client_max_body_size 4g;   keepalive_timeout 10; } 

i tried config not work

server {   listen 80 default deferred;   server_name rails.com;   root /home/deployer/apps/rails/current/public;    location ^~ /assets/ {     gzip_static on;     expires max;     add_header cache-control public;   }    try_files $uri/index.html $uri /;    location / {     auth_basic "restricted";     auth_basic_user_file /var/www/prototyp/.htpasswd;     proxy_set_header x-forwarded-for $proxy_add_x_forwarded_for;     proxy_set_header host $http_host;     proxy_redirect off;     proxy_pass http://unicorn;   }    error_page 500 502 503 504 /500.html;   client_max_body_size 4g;   keepalive_timeout 10; } 

do work:

location / {     auth_basic "restricted";     auth_basic_user_file /var/www/prototyp/.htpasswd;     proxy_set_header x-forwarded-for $proxy_add_x_forwarded_for;     proxy_set_header host $http_host;     proxy_redirect off;     proxy_pass http://unicorn; } 

you don't need @unicorn location


Comments

Popular posts from this blog

python - How to create a legend for 3D bar in matplotlib? -

java - Multi-Label Document Classification -

php - Dynamic url re-writing using htaccess -