0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

Mastodonインスタンスを閉鎖したときにnginxでHTTP 410 Gone を返す

Posted at

Mastodonインスタンスを閉鎖したときに HTTP 410 Gone を返す設定をしたのでメモ

mastodon.conf
# ================================================== #
#  Copyright (c) 2024 CIB-MC                         #
#  Released under the MIT license                    #
#  https://opensource.org/licenses/mit-license.php   #
# ================================================== #

server {
    server_name example.com;
    listen [::]:443 ssl http2;
    listen 443 ssl http2;
    access_log /var/log/nginx/access_example_com.log;

    ssl_certificate /etc/letsencrypt/live/example.com/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/live/example.com/privkey.pem;
    include /etc/letsencrypt/options-ssl-nginx.conf;
    ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem;
    error_page 410 /410.html;
    location = /410.html {
        root /var/www/example.com/;
        internal;
    }
    location ~ ^/ {
        return 410;
    }
}

server {
    server_name example.com;

    listen [::]:80;
    listen 80;
    return 302 https://$host$request_uri;
}
410.html
<!DOCTYPE html>
<html>
    <!--  Copyright (c) 2024 CIB-MC                        -->
    <!--  Released under the MIT license                   -->
    <!--  https://opensource.org/licenses/mit-license.php  -->
    <head>
        <meta charset="UTF-8">
        <title>HTTP 410 Gone</title>
    </head>
    <body>
        <p><strong>HTTP 410 Gone</strong></p>
        <p>本Mastodonインスタンスは運用を終了しました。<br>This Mastodon instance has been closed.</p>
    </body>
</html>
0
0
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
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?