<p dir="ltr">Yeah use /index.HTML for the location block</p>
<div class="gmail_quote">On Nov 6, 2012 8:43 PM, "Tharanga Abeyseela" <<a href="mailto:tharanga.abeyseela@gmail.com">tharanga.abeyseela@gmail.com</a>> wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hi Guys,<br>
<br>
I need to add basic auth to my home page (index.html) (Served by<br>
nginx) and other directories resides on tomcat7. is there anyway i<br>
can add only authentication to index.html . i was using the following<br>
nginx configuration.<br>
<br>
server {<br>
access_log /var/log/nginx/access.log;<br>
error_log /var/log/nginx/error.log;<br>
index index.html;<br>
root /var/www/;<br>
server_name xxxxxxxx;<br>
}<br>
<br>
location / {<br>
auth_basic "Restricted";<br>
auth_basic_user_file /var/www/.htpass;<br>
}<br>
<br>
<br>
<br>
location /next {<br>
proxy_pass <a href="http://localhost:8080/next" target="_blank">http://localhost:8080/next</a>;<br>
proxy_redirect off;<br>
proxy_set_header Host $host;<br>
proxy_set_header X-Real-IP $remote_addr;<br>
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;<br>
proxy_max_temp_file_size 0;<br>
}<br>
<br>
when i try to add the above config, it asks for the user/pass, but it<br>
asks for the user/pass when i try to access /next. but i need to add<br>
authentication only to index.html. problem is using the root<br>
directory, so all requests will be tunneled through root and prompted<br>
for a password. but is there any way i can restrict access only to<br>
index.html, once it authenticated, users will be able to access tomcat<br>
paths .<br>
<br>
Thanks in advance,<br>
Tharanga<br>
<br>
_______________________________________________<br>
nginx mailing list<br>
<a href="mailto:nginx@nginx.org">nginx@nginx.org</a><br>
<a href="http://mailman.nginx.org/mailman/listinfo/nginx" target="_blank">http://mailman.nginx.org/mailman/listinfo/nginx</a><br>
</blockquote></div>