作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我们已将 Nginx 配置为对我们的整个站点使用基本身份验证:
location / {
# ... More stuff goes here ...
# authentication
auth_basic "Restricted";
auth_basic_user_file /etc/nginx/conf.d/.htpasswd;
}
现在在一个特定的位置下,比如 /x
,我也想允许 /etc/nginx/conf.d/.htpasswd
中定义的所有用户作为在另一个密码文件中定义的一些其他用户。 IE。像这样的东西(不起作用):
location /x {
# authentication
auth_basic "Restricted";
auth_basic_user_file /etc/nginx/conf.d/.htpasswd, /etc/nginx/conf.d/.otherhtpasswd;
}
我如何使用 Nginx 实现这一目标?
最佳答案
由于 nginx
不接受多个 auth_basic_user_file
指令,我将创建一个简单的脚本来将两个文件连接成第三个文件。然后使用 auth_basic_user_file
指令引用该文件。然后,您可以将其放入 cron 作业中,或者在每次其中一个文件更改时运行它。
关于nginx - 为 Nginx 中的特定位置附加 auth_basic_user_file,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47567895/
我们已将 Nginx 配置为对我们的整个站点使用基本身份验证: location / { # ... More stuff goes here ... # authentication
我为不同的客户提供了几个下载文件夹。每个文件夹都必须使用自己的 .htaccess 文件进行密码保护。 为了简化我的 nginx 配置,我有以下问题: 如何从 URI 中提取客户名称(“custome
我是一名优秀的程序员,十分优秀!