自作エラーページ(401 Authorization Required)を設定したい
TOP › Forums › 使い方全般(Fixing KUSANAGI) › 自作エラーページ(401 Authorization Required)を設定したい
自作エラーページ(401 Authorization Required)を設定したい
- This topic has 2 replies, 2 voices, and was last updated 9 years ago by
ManA.
-
AuthorPosts
-
-
2017年7月12日 at 23:15 #263
kusanagiにてnginxとHHVMとSSLでWordpressをベーシック認証を付けて動かしています。
ベーシック認証に失敗するとデフォルトの401のエラーページが表示されるので、それを自作しようと思いました。/etc/nginx/conf.d/hogepiyo_html_ssl.conf へ
error_page 401 = /index.php?status=401;
と、記述を行いましたがデフォルトの401のままでした。
# kusanagi nginx や # reboot で再起動しても自作エラーページは表示されませんでした。kusanagi status を貼ります。
# kusanagi status
Profile: hogepiyo_html
Type: WordPress
KUSANAGI Version 8.0.7-3
conoha*** nginx ***
● nginx.service - The NGINX HTTP and reverse proxy server
Loaded: loaded (/usr/lib/systemd/system/nginx.service; enabled; vendor preset: disabled)
Active: active (running) since 水 2017-07-12 10:44:01 JST; 10h ago*** Apache2 ***
● httpd.service - The Apache HTTP Server
Loaded: loaded (/usr/lib/systemd/system/httpd.service; disabled; vendor preset: disabled)
Active: inactive (dead)*** HHVM ***
● hhvm.service - HHVM virtual machine, runtime, and JIT for the PHP language
Loaded: loaded (/etc/systemd/system/hhvm.service; enabled; vendor preset: disabled)
Active: active (running) since 水 2017-07-12 10:34:19 JST; 10h ago*** php-fpm ***
● php-fpm.service - The PHP FastCGI Process Manager
Loaded: loaded (/usr/lib/systemd/system/php-fpm.service; disabled; vendor preset: disabled)
Active: inactive (dead)*** php7-fpm ***
● php7-fpm.service - The PHP FastCGI Process Manager
Loaded: loaded (/usr/lib/systemd/system/php7-fpm.service; disabled; vendor preset: disabled)
Active: inactive (dead)*** Cache Status ***
fcache off
bcache off
完了しました。その後に調べてみましたが解決には至っておりません。
nginxでerror_pageが動かない!となった時の対処法
ttp://blog.rutti.net/item_2011.htmlここに「"fastcgi_intercept_errors"をonにしてやると解決」とありましたが
fastcgi_intercept_errorsはhogepiyo_html_ssl.conf内でonになっています。nginxでproxyしてるときにカスタムのエラーページを表示する
ttp://d.hatena.ne.jp/nekonokataomoi/20130619/1371605238「proxy_pass http://backends;」の記述を使用しているのはnginxとHHVMでしたが
追記しました。追記後 # kusanagi nginx や # reboot で再起動しても
自作エラーページは表示されませんでした。私のやり方が間違っているのでしょうか。
お願いします!自作エラーページを設定する方法を教えてください!-
This topic was modified 9 years ago by
katuo.
-
This topic was modified 9 years ago by
-
2017年7月12日 at 23:44 #265
静的HTMLでやってみてもダメでした。
error_page 401 /401.html;
location = /401.html {
# ドキュメントルート内に入れない
root /home/kusanagi/hogepiyo_html/401;
} -
2017年7月19日 at 17:15 #279
/home/kusanagi/hogepiyo_html/401/401.htmlというファイルが存在してるのでしょうか?
仮に以下のようなディレクトリ構造だとしたら
/home/kusanagi/hogepiyo_html/401.html以下のように記述したらうまくいくのではないでしょうか。試していませんが。
error_page 401 /401.html;
location = /401.html {
root /home/kusanagi/hogepiyo_html;
}
-
-
AuthorPosts
- You must be logged in to reply to this topic.
