我试图根据 IP 限制对 wp-login 页面的访问,使用以下代码,我能够限制对 wp-admin 的访问,但 login.php 仍然可以访问:
server {
listen 80;
root /app/;
index index.php;
location = /favicon.ico {
log_not_found off;
access_log off;
}
location = /robots.txt {
allow all;
log_not_found off;
access_log off;
}
location / {
try_files $uri $uri/ /index.php?$args;
}
location ~ /\. {
deny all;
}
location ~* /(?:uploads|files)/.*\.php$ {
deny all;
}
location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ {
expires max;
log_not_found off;
}
location ~ \.php {
include fastcgi_params;
fastcgi_pass php:9000;
fastcgi_index index.php;
fastcgi_read_timeout 10s; …Run Code Online (Sandbox Code Playgroud)