• NGINX > user agent

       

      server {
         listen 80;
         server_name _;
         root /usr/share/nginx/html;
      
         location ~ \.php$ {
            ...
         }
      
         location ~ /admin {
            if ($http_user_agent !~* "toto") {
               return 404;
            }
            try_files $uri =404;
          }
      }

       

      restart nginx service before test!

      It works but if you access /admin/login.php doesn’t check user-agent :(

 

Aucun commentaire

 

Laissez un commentaire