当前位置:首页 > 未分类 > 正文内容

nginx 设置某个目录只允许访问指定后缀文件

admin1年前 (2025-01-15)未分类4871

server {
        listen 80;
        server_name your_domain.com;
         
        location /example_directory/ {
            # 允许访问 特定 后缀的文件
            location ~* \.(png|jpg|jpeg|PNG|JPG|JPEG)$ {
                allow all;
                try_files $uri $uri/ =404;
            }
         
            # 拒绝其他所有请求
            deny all;
        }
         
        # 其他配置...
    }


扫描二维码推送至手机访问。

版权声明:本文由web开发技术分享发布,如需转载请注明出处。

本文链接:https://www.htmlcmf.cn/?id=14

分享给朋友:

相关文章

jquery的ajax设置为同步

jquery的ajax设置为同步在使用$.get或者$.post的时候,前面加上$.ajaxSettings.async = false;使用完之后再设置为异步$.ajaxSettings.async = true; 而在使用$....

first-child 不起作用的原因

CSS3—first-child 不起作用的原因1、first-child、last-child、nth-child(n)、nth-child(2n)、nth-child(2n-1)、nth-child(odd)、nth-child(eve...

CSS:实现background-image背景图片全屏铺满自适应

body {     /* 加载背景图 */     background-image: url(images/bg...

css文字颜色渐变

background-size: 100%; background-repeat: repeat; background-clip: text; -webkit-background-clip: ...

vue修改数据不生效

Vue修改数据不生效的问题通常发生在以下几种情况:直接修改了Vue实例的data对象的根级属性。修改数组时没有使用Vue提供的特定方法(例如push、splice),导致视图不更新。对象属性添加、删除不是响应式的,需要使用Vue.set或v...

css隐藏滚动条

实现css隐藏滚动条有以下几种方式:1. 使用overflow属性:将父元素的overflow属性设置为hidden,这将隐藏滚动条,并且禁用滚动功能。例如:.parent {     o...