Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
[Nginx][WordPress] Nginx で WordPress の管理画面に BASIC 認証をかける ( ただし /wp-admin/admin-ajax.php, /wp-admin/css/*, /wp-admin/js/* にはかけない )
location ~* /wp-login\.php|/wp-admin/((?!(admin-ajax\.php|css/|js/)).)*$ {
index index.php index.html index.htm;
# Basic認証のメッセージ
auth_basic "Please enter your ID and password";
# .htpasswd ファイルのパス
auth_basic_user_file /etc/nginx/conf.d/.htpasswd;
location ~ .*\.php$ {
try_files $uri =404;
proxy_pass http://backend;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.