この内容は古いバージョンです。最新バージョンを表示するには、戻るボタンを押してください。
バージョン:1
ページ更新者:T
更新日時:2018-12-12 01:36:21

タイトル: SSLの設定
SEOタイトル: Apache2のSSL設定

前提

OS: CentOS(異なるOSの場合適宜読み替えて下さい)

Webサーバー: Apache2

ドキュメントルート: /var/www/html (異なる場合は適宜読み替えて下さい)

 

インストール

yum install epel-release
yum install certbot python-certbot-apache

 

証明書の発行

certbot certonly --webroot -w /var/www/html/ -d <domain name>

以下の入力を促されます。

・証明書切れの通知アドレス

・証明書への同意

・Electronic Frontier Foundation からの定期購読メール送信可否

 

/etc/httpd/conf.d/ssl.conf の設定

SSLCertificateFile /etc/letsencrypt/live/<domain_name>/cert.pem
SSLCertificateKeyFile /etc/letsencrypt/live/<domain_name>/privkey.pem
SSLCertificateChainFile /etc/letsencrypt/live/<domain_name>/chain.pem

 

SSLポート解放

firewall-cmd --add-port=443/tcp --zone=public
firewall-cmd --add-port=443/tcp --zone=public --permanent

 

常時SSL化

/var/www/html/.htaccess を以下の内容で作成

yum install epel-release
yum install certbot python-certbot-apache

 

.htaccessを有効にするため /etc/httpd/conf/httpd.conf を修正

<Directory “/var/www/html”>
AllowOverride All
</Directory>

 

apacheの再起動をして完了です。