wordpress保护wp-login.php和wp-cron.php

禁止访问/wp-admin/install.php

location ~ ^/wp-admin/install\.php {
    deny all;
    log_not_found off;
    access_log off;
}```
禁止外部访问wp-config.php

location ~ ^/wp-cron.php {
allow 127.0.0.1;#本地IP
allow 162.250.97.124;#服务器IP
deny all;
location ~ .*.php?{  
        try_files
uri =404;
fastcgi_pass unix:/tmp/php-cgi.sock;
fastcgi_index index.php;
include fastcgi.conf;
}
}

为wp-login.php增加认证

location ~ ^/wp-login.php {
auth_basic “renzheng “;
auth_basic_user_file /.passwd;
location ~ .*.php?{  
        try_files
uri =404;
fastcgi_pass unix:/tmp/php-cgi.sock;
fastcgi_index index.php;
include fastcgi.conf;
}
}
“`

你可能感兴趣的:(nginx)