nginx basic authentication on all pages except a specific URL and it's follow

霸气de小男生 提交于 2020-01-02 07:14:40

问题


Am implementing basic authentication on my Ubuntu server. I want to except url and all it follows. example, the url i want to except is sample.com/sample/ and all of it follows like sample.com/sample/1, sample.com/sample/2, sample.com/sample/samdsFFGRwd12, sample.com/sample/FHFEdsa1g65

How to make this possible?


回答1:


To exclude URL from the basic authentication of nginx, need to add in your nginx conf something like:

location /sample/ {
    auth_basic off;
}


来源:https://stackoverflow.com/questions/38431499/nginx-basic-authentication-on-all-pages-except-a-specific-url-and-its-follow

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!