Created
January 23, 2017 02:27
-
-
Save Kaiyuan/ffa0668f1f2f96036049dfced44376b5 to your computer and use it in GitHub Desktop.
Wordpress 使用 nginx 禁止不带参数访问 xmlrpc.php 和 wp-login.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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