2020年8月24日月曜日

サクラVPSにSSLを導入

 1)certbotインストール

yum install certbot python2-certbot-apache


2)apache confファイルの最後に下記VirtualHost追加


NameVirtualHost *:80


<VirtualHost *:80>

ServerAdmin root@xxx.com

DocumentRoot /var/www/html/site/public

ServerName xxx.com


3)certbotコマンドを実行して証明書をインストール

certbot --apache -d xxx.com

※実施中、httpをhttpsへredirectするか聞いてくる際、redirectするようにします。


初期ドメイン→独自ドメイン リダイレクト

以下の内容をapache confファイルに追加

<VirtualHost *:80>

ServerAdmin root@xxx.com

DocumentRoot /var/www/html/site/public

ServerName os1-234-56789.vs.sakura.ne.jp

RewriteEngine on

RewriteCond %{SERVER_NAME} =os1-234-56789.vs.sakura.ne.jp

RewriteRule ^ https://xxx.com%{REQUEST_URI} [END,NE,R=permanent]


4)証明書を更新

certbot renew

0 件のコメント:

コメントを投稿