メインコンテンツに移動
ネットワークを右往左往

メインナビゲーション

  • ホーム
  • 今日のご飯
  • 攻撃の履歴
ユーザーアカウントメニュー
  • ログイン

パンくず

  1. ホーム

[備忘録]サーバのCertbot設定

By aki, 18 10月, 2025

Certbotの認証に利用するWebサーバをインストール。新しいサーバにはleantimeをインストールする予定なので、その手順に沿って、apache のインストールまで進めたところでCertbotの認証を実施してみる。leantimeの設定手順についてはこちら

 

apacheインストール

root@lt01:~# apt-get install apache2

ディレクトリ作成

root@lt01:~# cd /var/www/
root@lt01:/var/www# mkdir -p ./certbot/.well-known/acme-challenge
root@lt01:/var/www# chown -R www-data:www-data ./certbot
root@lt01:/var/www# chmod -R 755 ./certbot

VirtualHost設定

<VirtualHost *:8899>
    ServerName lt.gp7.info
    DocumentRoot /var/www/certbot
    CustomLog /var/log/apache2/certbot.log common
    ErrorLog /var/log/apache2/certbot.err
    <Directory "/var/www/certbot/.well-known/acme-challenge">
        Options MultiViews
	AllowOverride All
	Order allow,deny
        Allow from all
    </Directory>
</VirtualHost>

設定有効化

root@lt01:/etc/apache2# a2ensite certbot
Enabling site certbot.
To activate the new configuration, you need to run:
  systemctl reload apache2
root@lt01:/etc/apache2# systemctl reload apache2
root@lt01:/etc/apache2#

certbotインストール

root@lt01:/# apt-get install certbot

認証実施

root@lt01:/# certbot certonly --webroot -w /var/www/certbot/ -d lt.gp7.info --preferred-challenges http
Saving debug log to /var/log/letsencrypt/letsencrypt.log
Requesting a certificate for lt.gp7.info

Successfully received certificate.
Certificate is saved at: /etc/letsencrypt/live/lt.gp7.info/fullchain.pem
Key is saved at:         /etc/letsencrypt/live/lt.gp7.info/privkey.pem
This certificate expires on 2026-01-16.
These files will be updated when the certificate renews.
Certbot has set up a scheduled task to automatically renew this certificate in the background.

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
If you like Certbot, please consider supporting our work by:
 * Donating to ISRG / Let's Encrypt:   https://letsencrypt.org/donate
 * Donating to EFF:                    https://eff.org/donate-le
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
root@lt01:/v#

証明書確認

root@lt01:/# cd /etc/letsencrypt/live/

# domainのディレクトリができている
root@lt01:/etc/letsencrypt/live# ls -l
total 8
drwxr-xr-x 2 root root 4096 Oct 19 00:26 lt.gp7.info

# 証明書関連のフィルができていることを確認
root@lt01:/etc/letsencrypt/live# ls -l ./lt.gp7.info/
total 4
lrwxrwxrwx 1 root root  35 Oct 19 00:26 cert.pem -> ../../archive/lt.gp7.info/cert1.pem
lrwxrwxrwx 1 root root  36 Oct 19 00:26 chain.pem -> ../../archive/lt.gp7.info/chain1.pem
lrwxrwxrwx 1 root root  40 Oct 19 00:26 fullchain.pem -> ../../archive/lt.gp7.info/fullchain1.pem
lrwxrwxrwx 1 root root  38 Oct 19 00:26 privkey.pem -> ../../archive/lt.gp7.info/privkey1.pem
-rw-r--r-- 1 root root 692 Oct 19 00:26 README
  • コメントを投稿するにはログインまたは登録をしてください

コメント

AbuseIPDB Contributor Badge

本日の攻撃

20260105
CountryCount
kr67
lt143
nl51
pl1
ru1
us10
vn272
cn261
Powered by Drupal