Skip to content

Instantly share code, notes, and snippets.

@miladoll
Created July 19, 2020 09:18
Show Gist options
  • Select an option

  • Save miladoll/fc282004348691b74793c648c2f4fa48 to your computer and use it in GitHub Desktop.

Select an option

Save miladoll/fc282004348691b74793c648c2f4fa48 to your computer and use it in GitHub Desktop.
ぼくのかんがえたかっこいいWordPress管理ページアクセス拒否.conf
// safe_hosts.conf
geo $safe_hosts {
default 0;
127.0.0.1 1;
# : etc.
}
// is_wordpress_admin_page.conf
map $uri $is_wordpress_admin_page {
default 0;
"~^/wp-login\.php" 1;
# : etc.
}
// host_www.hogehoge.com.conf
set $NONESAFE_ADMINACCESS "";
if ( $safe_hosts = 0 ) {
set $NONESAFE_ADMINACCESS "NONESAFE";
}
if ( $is_wordpress_admin_page = 1 ) {
set $NONESAFE_ADMINACCESS "${NONESAFE_ADMINACCESS}_ADMINACCESS";
}
if ( $NONESAFE_ADMINACCESS = "NONESAFE_ADMINACCESS" ) {
return 403;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment