
直接屏蔽外部访问,仅允许服务器自身访问 (因为 WordPress 执行任务的时候,就是在服务器上请求的)。在你的域名 conf 下,添加下面语句:
#禁止外网访问wp-cron
location ~ ^/wp-cron\.php {
allow 127.0.0.1;#本地IP
allow 127.255.255.255;#服务器IP
deny all;
location ~ .*\.php?$ {
try_files $uri =404;
fastcgi_pass unix:/tmp/php-cgi.sock;
fastcgi_index index.php;
include fastcgi.conf;
}
}
这样就 ok 了。
现在的 WordPress 的安装文件(/wp-admin/install.php)建议安装后,禁止访问吧。
只要:
#禁止读取install
location ~ ^/wp-admin/install\.php {
deny all;
log_not_found off;
access_log off;
}
为什么不直接删除呢,因为每次 WordPress 更新后,都有。
至于为什么屏蔽,原因就是,访问它,它会读取内部 cache(一般在 MySQL,如果你没转移的话),如果不存在,读取 MySQL 数据库,确认安装,返回安装完毕,设置 cache(同样,如果没有外部 Cache,那么就在 MySQL 里面)。
- All rights reserved.
- No part of this website, including text and images, may be reproduced, modified, distributed, or transmitted in any form or by any means, without the prior written permission of the author.
- Unauthorized commercial use is strictly prohibited.
- Unauthorized personal use is strictly prohibited.