首页 > 解决方案 > Ngix 配置不起作用。(阻止文件访问)

问题描述

我有一个简短的问题。我有这个 nginx 配置



server {
   root /var/www/html/license/;
   listen 80;
   server_name here is my domain;
   
   location ~ \.txt$ {
       return 403;
   }
   
   location ~ \.php$ {
       include snippets/fastcgi-php.conf;
       fastcgi_pass unix:/var/run/php/php7.2-fpm.sock;
   }
}



我的目标是阻止对所有 .txt 文件的访问!为什么这不起作用?一切都是正确的我做错了什么?

标签: nginx

解决方案


推荐阅读