1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

Nginxのエラー画面を猫ちゃんにする

Posted at

たぶん対象になる人

VPSサーバを触ることができる人かな

やり方

こちらから猫ちゃんの画像をDownloadします。
https://icons8.jp/ouch/illustration/ginger-cat-714

nginxのデフォルト画面は/usr/share/nginx/html/に移動します。

cd /usr/share/nginx/html

index.html,404.html,50x.htmlに以下のコードで上書きします。

index.html
<!Doctype html>
<html>
  <head>
    <meta charset="UTF-8">

    <title> ERROR </title>
    <style>
      html {
        font-size: 14px;
      }
      body {
        text-align: center;
        margin-top: 5rem;
      }
      h2 {
        color: #af8f71;
      }
      .center {
        margin: 0 auto;
      }
      small {
        text-align: center;
          margin: 0 auto;
            display:block;
      }
      small a{
        text-decoration: none;
        color: #b2d479;
        font-size: 1rem;
      }
    </style>
  </head>

  <body>
    <h2>Website ???? 404</h2>
    <img src="ginger-cat-713.png" width="300px">

    <small>
      <a rel="nofollow noopener external" href="https://icons8.jp/ouch/illustration/ginger-cat-714">(c) gingerCat</a>
    </small>
  </body>
</html>

保存後、nginx標準のエラー画面がこのような猫さんになります。

コメント 2020-05-10 003432.jpg

*ターミナルを使えない場合は、手元PCで作ったhtmlを、レンタルサーバ契約時にもらったSSH認証ID/PASSを使ってSCP転送します。SSH接続できるサーバにはSCPで接続できるから、filezilaを使うと便利。

1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?