環境
1時間で出来る!最強のWordPress環境構築(永久無料) を参考に Google Cloud Platform 上に
WordPress 環境を構築。
当方の設定過不足が原因かと思われますが、メモとして残します。
症状
WordPress 管理画面にてプラグイン IP Geo Block の設定ページを開くと以下のエラーアラートが表示される。
Ajaxコマンド
ip_geo_block
の実行中にエラーが発生しました。 (0)
Chrome の Console を確認すると admin-ajax.php
で POST エラーが発生していることがわかる。
作業
プラグインからの admin-ajax.php
へのアクセスを許可する為に htaccess
設定を行います。
Bitnami の WordPress ではセキュリティおよびパフォーマンス上の理由から .htaccess
ファイルが無効に
設定されているので htaccess.conf
を使用します。
https://community.bitnami.com/t/how-to-access-the-htaccess-conf-file/38410/2
Google Cloud Platform -> Compute Engine -> VMインスタンス
接続 欄の SSH をクリックしてコンソールを起動して htaccess.conf
を編集する。
$ cd /opt/bitnami/apps/wordpress/conf/
$ sudo vi htaccess.conf
<Directory "/opt/bitnami/apps/wordpress/htdocs/">
<FilesMatch "(admin-ajax.php)$">
Satisfy Any
Order allow,deny
Allow from all
Deny from none
</FilesMatch>
</Directory>
サーバーを再起動する。
$ sudo /opt/bitnami/ctlscript.sh restart nginx
Unmonitored nginx
/opt/bitnami/nginx/scripts/ctl.sh : Nginx stopped
/opt/bitnami/nginx/scripts/ctl.sh : Nginx started
Monitored nginx
WordPress 管理画面にてエラーが解消されていることを確認する。
参考
https://blog.systemjp.net/entry/2017/08/12/001704
https://kimiyakitani.wordpress.com/2014/02/13/how-to-resolve-admin-ajax-error/
https://www.d-wood.com/blog/2016/05/25_8076.html
https://www.radia.jp/archives/319