Шаг 1. Установка Certbot
# apt-get install python3-acme python3-certbot python3-mock python3-openssl python3-pkg-resources python3-pyparsing python3-zope.interface -y
# apt-get install python3-certbot-nginx -y
Шаг 2. Проверка имени домена
# vim /etc/nginx/suite-available/default
server {
...
server_name rus-notes.ru www.rus-notes.ru;
...
}
...
server_name rus-notes.ru www.rus-notes.ru;
...
}
Шаг 3. Получение SSL-сертификата
# certbot --nginx -d rus-notes.ru -d www.rus-notes.ru
...
Account registered.
Requesting a certificate for rus-notes.ru and www.rus-notes.ru
Successfully received certificate.
Certificate is saved at: /etc/letsencrypt/live/rus-notes.ru/fullchain.pem
Key is saved at: /etc/letsencrypt/live/rus-notes.ru/privkey.pem
This certificate expires on 2025-03-30.
These files will be updated when the certificate renews.
Certbot has set up a scheduled task to automatically renew this certificate in the background.
Deploying certificate
Successfully deployed certificate for rus-notes.ru to /etc/nginx/sites-enabled/default
Successfully deployed certificate for www.rus-notes.ru to /etc/nginx/sites-enabled/default
Congratulations! You have successfully enabled HTTPS on https://rus-notes.ru and https://www.rus-notes.ru
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
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
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Account registered.
Requesting a certificate for rus-notes.ru and www.rus-notes.ru
Successfully received certificate.
Certificate is saved at: /etc/letsencrypt/live/rus-notes.ru/fullchain.pem
Key is saved at: /etc/letsencrypt/live/rus-notes.ru/privkey.pem
This certificate expires on 2025-03-30.
These files will be updated when the certificate renews.
Certbot has set up a scheduled task to automatically renew this certificate in the background.
Deploying certificate
Successfully deployed certificate for rus-notes.ru to /etc/nginx/sites-enabled/default
Successfully deployed certificate for www.rus-notes.ru to /etc/nginx/sites-enabled/default
Congratulations! You have successfully enabled HTTPS on https://rus-notes.ru and https://www.rus-notes.ru
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
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
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Шаг 4. Проверка автоматического обновления сертификата
# certbot renew --dry-run
Шаг 5. Настройка сертификатов в Nginx
После выполнения всех вышеперечисленных действия сертификаты автоматически прописывают в /etc/nginx/suite-availabe/default.
Комментариев нет:
Отправить комментарий