3
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

[備忘録]Let's Encrypt でSSL化してからDocumentRootを変更する方法

Last updated at Posted at 2020-06-29

#問題定義
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に上記のコードを追加しましょう。

3
3
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?