Сертификат для сайта на Apache (HTTPS + SSL)

Нужен ли сертификат для сайта или нет, есть необходимость в ssl и надо ли https вместо http решает каждый сам. 

Итак, имеем веб-сервер Debian c Apache2 и настроенным virtualhost, задача подключить https, ssl с сертификатом. 

Сертификат будет не самоподписанный, а настоящий из удостоверяющего центра, но бесплатный. Сегодня можно найти достаточно статей, где описывают как найти бесплатные центры сертификации.

Я выбрал Let's Encrypt. Сертификат выдается на 90 дней с последующим перевыпуском абсолютно бесплатно. 

Настроим:

1. Переходим на сайт https://certbot.eff.org/ и выбираем параметры сервера (Apache и Debian 9).

2. Добавим Stretch backports для Debian:

# echo "deb http://deb.debian.org/debian stretch-backports main" >> /etc/apt/sources.list
# apt-get update


3. Ставим CertBot:

# apt-get install certbot python-certbot-apache

4. Настраиваем Certbot под Apache:

# certbot --apache
  • вводим e-mail адрес куда получать сообщения от certbot
  • принимаем соглашение
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Please read the Terms of Service at
https://letsencrypt.org/documents/LE-SA-v1.2-November-15-2017.pdf. You must
agree in order to register with the ACME server at
https://acme-v02.api.letsencrypt.org/directory
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
(A)gree/(C)ancel:
  • отвечаем на вопрос "Хотели бы вы поделиться своим адресом электронной почты с Electronic Frontier?"
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Would you be willing to share your email address with the Electronic Frontier
Foundation, a founding partner of the Let's Encrypt project and the non-profit
organization that develops Certbot? We'd like to send you email about our work
encrypting the web, EFF news, campaigns, and ways to support digital freedom.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
(Y)es/(N)o: 
  • далее выбираем на какие доменные имена активировать HTTPS? 
Which names would you like to activate HTTPS for?
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
1: domain.ru
2: www.domain.ru
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Select the appropriate numbers separated by commas and/or spaces, or leave input
blank to select all options shown (Enter 'c' to cancel):
  • Выбираем, следует ли перенаправлять HTTP-трафик на HTTPS, удаляя доступ HTTP? Я выбираю Redirect.
Please choose whether or not to redirect HTTP traffic to HTTPS, removing HTTP access.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
1: No redirect - Make no further changes to the webserver configuration.
2: Redirect - Make all requests redirect to secure HTTPS access. Choose this for
new sites, or if you're confident your site works on HTTPS. You can undo this
change by editing your web server's configuration.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Select the appropriate number [1-2] then [enter] (press 'c' to cancel):
  • Создаются настройки и...
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Congratulations! You have successfully enabled https://domain.ru and
https://www.domain.ru

You should test your configuration at:
https://www.ssllabs.com/ssltest/analyze.html?d=domain.ru
https://www.ssllabs.com/ssltest/analyze.html?d=www.domain.ru
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

IMPORTANT NOTES:
 - Congratulations! Your certificate and chain have been saved at:
   /etc/letsencrypt/live/domain.ru/fullchain.pem
   Your key file has been saved at:
   /etc/letsencrypt/live/domain.ru/privkey.pem
   Your cert will expire on 2019-07-09. To obtain a new or tweaked
   version of this certificate in the future, simply run certbot again
   with the "certonly" option. To non-interactively renew *all* of
   your certificates, run "certbot renew"
 - Your account credentials have been saved in your Certbot
   configuration directory at /etc/letsencrypt. You should make a
   secure backup of this folder now. This configuration directory will
   also contain certificates and private keys obtained by Certbot so
   making regular backups of this folder is ideal.
 - 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

5. Проверяем наш сайт в браузере и замечаем, что произошло перенаправление на https


На этом все. Наш сертификат установлен, сайт работает только по https, все запросы по http перенаправляются на https.

Остается настроить планировщик задач (crontab) на перевыпуск сертификата каждые 90 дней с командой:
certbot renew --dry-run

Комментарии

  1. The Casino at Hrissen-Wetten - MapyRO
    The Casino at Hrissen-Wetten in 여주 출장샵 Wermont, 안양 출장안마 N.J. - Use this simple form to find casinos 부산광역 출장샵 with slots, 평택 출장샵 bingo, bingo and blackjack games. 김제 출장마사지

    ОтветитьУдалить

Отправить комментарий

Популярные сообщения из этого блога

Разные версии PHP на разных сайтах на одном сервере

Microsoft Office. Окно "Давайте начнем"

Импорт - Экспорт пользователей Active Directory