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>