-2

I want my server to refuse to view and download all non-php files, So i wrote this code in "nginx.conf":

enter image description here

I restarted the server, did some testing, and found that it didn't work. Where is the mistake, please?

Mike M
  • 4,358
  • 1
  • 28
  • 48
Wang Hao
  • 3
  • 2

1 Answers1

0

Instead of using a negate block you can use something like below

server {
    listen 80;

    location / {
        deny all;
    }

    location ~ \.php$ {
        fastcgi_pass ...;
        ....;
    }
}
Tarun Lalwani
  • 142,312
  • 9
  • 204
  • 265