大佬教程收集整理的这篇文章主要介绍了如何将经过身份验证的Nginx用户映射到他们自己的目录?,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
我正在用C编写一个社交网站,并用Nginx提供服务.我如何才能使经过身份验证的用户访问他们自己的目录-ONLY-用户特定的index.html所在的目录.我不是问如何使用特定于用户的指令填充index.html,而是如何将它们锁定到自己的目录中
@H_780_7@map $remote_user $profile_directory { default $remote_user; '' guests; pavel admins; ivan admins; } server { LOCATIOn /profile/ { alias /path/to/www/$profile_directory/; ... } }
> http://nginx.org/en/docs/http/ngx_http_core_module.html#variables
> http://nginx.org/r/map
> http://nginx.org/r/alias
> http://nginx.org/r/root
> http://nginx.org/r/LOCATIOn
第二个例子(见评论):
server {
LOCATIOn / {
auth_basic "Please Login";
auth_basic_user_file "/etc/Nginx/htpasswd";
root /var/www/sites/mysite.com/http/$remote_user;
}
}
以上是大佬教程为你收集整理的如何将经过身份验证的Nginx用户映射到他们自己的目录?全部内容,希望文章能够帮你解决如何将经过身份验证的Nginx用户映射到他们自己的目录?所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。