Let’s encrypt on Arch Linux

nextcloudをhttpsに移行するため,pacman -S certbot-nginxをインストール。
certbot –nginx -d xx.xx.comで設定終了。
cloud-inital.confに設定が書き込まれる。
arch wiki から,nextcloud.confをコピーする。
ドメイン名を修正して,systemctl restart nginx。
httpsでnextcloudが使用できる。
https://www.ssllabs.com/ssltest/index.htmlでSSLの確認

久々に再設定してみた。
pacman -S nginxからインストール
vi /etc/nginx/nginx.confでserver_nameを変更
nginx -tで確認するとtypes_hash_max_size 1024;またはtypes_hash_bucket_size 64;を増やせと警告がでるので、後者を128に増やしておく。
systemctl enable nginx
systemctl start nginx
systemctl status nginx
pacman -S certbot-nginxでインストール
ufw allow 80/tcp
ufw allow 443/tcp
certbot –nginx
これで、/etc/nginx/nginx.confがhttps用に追記される。
certbot nenewで更新

自動更新の設定にはtimerを使用する。
cd /etc/systemd/system
vi certbot.service
[Unit]
Description=Let’s Encrypt renewal
[Service]
Type=oneshot
ExecStart=/usr/bin/certbot renew –quiet –agree-tos –max-log-backups 60 –post-hook “systemctl reload nginx.service”
systemctl start certbot
systemctl status certbotで確認
/var/log/letsencryptにログができ、デフォルトは1000なので制限する。
vi certbot.timer
[Unit]
Description=Daily renewal of Let’s Encrypt’s certificates
[Timer]
OnCalendar=weekly
RandomizedDelaySec=1h
Persistent=true
[Install]
WantedBy=timers.target
systemctl start certbot.timer
systemctl status certbot.timer
systemctl enable certbot.timer
systemctl list-timers


コメント