[LINUX] [Note] How to change DocumentRoot after SSL conversion with Let's Encrypt

Problem definition

I made the VPS server (conoha's centos7) SSL with Let's Encrypt, but I can't change the DocumentRoot from var / www / html. I tried various articles, but I wrote it down because I couldn't read the essence because I didn't understand how Apache works.

environment

centos7 Apache/2.4.6

Solution

The SSL port number will be 443, so let's set that in VirtualHost.

etc/httpd/conf/httpd.conf


Listen 80
-------Added below------
<VirtualHost *:443>
  ServerAdmin [email protected]
  ServerName example.com
  DocumentRoot /Document Root of your choice/
  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 /Document Root of your choice/
    AllowOverride all
    Require all granted
    Options -MultiViews
  </Directory>
</VirtualHost>
----------------------
#
# Dynamic Shared Object (DSO) Support

Let's add the above code to httpd.conf.

Recommended Posts

[Note] How to change DocumentRoot after SSL conversion with Let's Encrypt
How to avoid BrokenPipeError with PyTorch's DataLoader Note
How to display images continuously with matplotlib Note
How to change Jupyter layout
How to update with SQLAlchemy?
[Note] How to use virtualenv
How to Alter with SQLAlchemy?
How to separate strings with','
How to change Python version
How to RDP with Fedora31
How to Delete with SQLAlchemy?
How to change Django's SQLite3 uploaded to python anywhere with GUI only
How to cancel RT with tweepy
Python: How to use async with
HTTPS with Django and Let's Encrypt
How to use virtualenv with PowerShell
How to deal with imbalanced data
MP3 to WAV conversion with Python
How to get started with Scrapy
How to deal with DistributionNotFound errors
How to get started with Django
How to Data Augmentation with PyTorch
How to change vim color scheme
How to use FTP with Python
How to calculate date with python
How to install mysql-connector with pip3
How to INNER JOIN with SQLAlchemy
How to install Anaconda with pyenv
How to authenticate with Django Part 2
How to authenticate with Django Part 3