[Nginx][WordPress] Nginx で WordPress の管理画面に BASIC 認証をかける ( ただし /wp-admin/admin-ajax.php, /wp-admin/css/*, /wp-admin/js/* にはかけない )
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 ~* /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