Quantcast
Channel: Nginx Forum - Nginx Mailing List - English
Viewing all articles
Browse latest Browse all 7229

can't get http authentication to work (no replies)

$
0
0
Hi, I'm trying to implement HTTP authentication as outlined in this article
https://www.digitalocean.com/community/articles/how-to-set-up-http-authentication-with-nginx-on-ubuntu-12-10

I went through the early steps in the tutorial where it prompts you to
create a password. That was fine. I then added the two auth_basic and
auth_basic_user_file lines to the second location block in my nginx.conf
(see below) and pushed it to my server (which necessarily restarts the
server), but the http authentication isn't happening. I can access my demo
rails app without problem.

Any ideas what I might be doing wrong? Thanks if you can help

upstream unicorn {
server unix:/tmp/unicorn.remotepg.sock fail_timeout=0;
}

server {
listen 80 default deferred;
# server_name example.com;
root /home/michael/apps/remotepg/current/public;

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;
auth_basic "Restricted";
auth_basic_user_file /home/michael/apps/remotepg/current/public/.htpasswd;
}

error_page 500 502 503 504 /500.html;
client_max_body_size 4G;
keepalive_timeout 10;
}
_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx

Viewing all articles
Browse latest Browse all 7229

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>