Please try this:
1) 将重写规则保存到文件:
/absolute/path/to/wp_security.conf
.
2) 然后将其包含在NginX配置文件中,并带有以下行:
include /absolute/path/to/wp_security.conf;
并将其置于服务器上下文中:
server {
#... cut ...
##
# include the Better WP Security configuration file
##
include /absolute/path/to/wp_security.conf;
location / {
try_files $uri $uri/ /index.php?$args;
}
#... cut ...
}
3) 记住重新加载NginX:
nginx -t && service nginx reload
4) 您可以轻松测试的内容之一是这一部分:
location ~ readme.html { deny all; }
激活此规则时,应拒绝访问
readme.html
尝试在浏览器中查看文件时: