Restricciones de IP de Nginx para directorios

  

nginx phpmyadmin Abierto para usuarios de intranet ip, los usuarios de ip de red externa están cerrados (en la configuración anterior, ubicación ~ ^ /directory /use regular, la prioridad es mayor que la ubicación /configuración, Por lo tanto, nginx no puede analizar la página de inicio.
El código es el siguiente

servidor {

escucha 80;

server_name example.com;

access_log logs /access.log Principal;

location /{

root html;

index index.php index.html index.htm;

}

La ubicación ~ ^ /phpmyadmin /{

permite 192.168.1.0/24;

deniega todo;

ubicación ~. *.
(Php | Php5)? $ {

root /var /mailapp /nginx /html;

fastcgi_pass 127.0.0.1:9000;

fastcgi_index index.php;

incluir fastcgi_params;

}

}

location ~. *.
(php | Php5)? $ {

root /opt /nginx /html;

fastcgi_pass 127.0.0.1:9000;

fastcgi_index index.php;

include Fastcgi_params;

}

}

También podemos configurar este código de
de la siguiente manera: server {listen 80; server_name example.com; access_log logs /access.log main; Ubicación /{root html; index index.php index.html index.htm;} location ~ ^ /download /{allow 192.168.1.0/24; deny all; index index.php index.do index.html index.htm; location ~. *.
(php | Php5)? $ {Root /var /mailapp /nginx /html; fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; incluye fastcgi_params;}} location ~. *.
(Php | Php5)? $ {Root /opt /nginx /html; astcgi_pass 127.0.0.1:9000; fastcgi_index index.php; incluye fastcgi_params;}

Copyright © Conocimiento de Windows All Rights Reserved