[備忘録]Let's Encrypt でSSL化してからDocumentRootを変更する方法
問題定義
VPSサーバー(conohaのcentos7)をLet's EncryptでSSL化したもののDocumentRootをvar/www/htmlから変更できない。色々な記事を試したみたが、Apacheの仕組み理解度が薄く本質が読めなく難航したので書き記します。
環境
centos7
Apache/2.4.6
解決方法
SSLのポート番号が443になるので、そちらをVirtualHostで設定してあげましょう。
etc/httpd/conf/httpd.conf
Listen 80
-------下記に追加------
<VirtualHost *:443>
ServerAdmin root@example.com
ServerName example.com
DocumentRoot /お好みのDocumentRoot/
SSLEngine on
SSLCertificateFile /etc/letsencrypt/live/example.com/cert.pem
SSLCertificateKeyFile /etc/letsencrypt/live/example.com/privkey.pem
SSLCertificateChainFile /etc/letsencrypt/live/example.com/chain.pem
<Directory /お好みのDocumentRoot/
AllowOverride all
Require all granted
Options -MultiViews
</Directory>
</VirtualHost>
----------------------
#
# Dynamic Shared Object (DSO) Support
httpd.confに上記のコードを追加しましょう。
Author And Source
この問題について([備忘録]Let's Encrypt でSSL化してからDocumentRootを変更する方法), 我々は、より多くの情報をここで見つけました https://qiita.com/ZAKILOG1/items/9b171b28e69afc9063bf著者帰属:元の著者の情報は、元のURLに含まれています。著作権は原作者に属する。
Content is automatically searched and collected through network algorithms . If there is a violation . Please contact us . We will adjust (correct author information ,or delete content ) as soon as possible .