Skip to content

Instantly share code, notes, and snippets.

@Kaiyuan
Created January 23, 2017 02:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Kaiyuan/ffa0668f1f2f96036049dfced44376b5 to your computer and use it in GitHub Desktop.
Save Kaiyuan/ffa0668f1f2f96036049dfced44376b5 to your computer and use it in GitHub Desktop.
Wordpress 使用 nginx 禁止不带参数访问 xmlrpc.php 和 wp-login.php
location ~* /(xmlrpc.php)$ {
if ($is_args = '') {
rewrite ^(.*) http://127.0.0.1/ permanent;
}
# location ~ .*\.php?$args {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index xmlrpc.php;
fastcgi_param SCRIPT_FILENAME /usr/share/nginx/html/$fastcgi_script_name;
include fastcgi_params;
# }
}
location ~* /(wp-login.php)$ {
if ($is_args = '') {
rewrite ^(.*) http://127.0.0.1/ permanent;
}
fastcgi_pass 127.0.0.1:9000;
fastcgi_index wp-login.php;
fastcgi_param SCRIPT_FILENAME /usr/share/nginx/html/$fastcgi_script_name;
include fastcgi_params;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment