vi /etc/httpd/conf/httpd.conf
<VirtualHost *:80>
RewriteEngine On
RewriteCond %{HTTPS} off
#RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}
ServerAdmin root@localhost
DocumentRoot /var/www/html/
ServerName subdomain57.domain.com
ServerAlias subdomain57.domain.com
ErrorLog /var/www/html/error.log
RewriteCond %{SERVER_NAME} =subdomain57.domain.com
RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
</VirtualHost>
Include /etc/httpd/conf/httpd-le-ssl.conf
------------------------------------------------------------------
vi /etc/httpd/conf/httpd-le-ssl.conf
<IfModule mod_ssl.c>
<VirtualHost *:443>
RewriteEngine On
# Some rewrite rules in this file were disabled on your HTTPS site,
# because they have the potential to create redirection loops.
# RewriteCond %{HTTPS} off
# #RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}
# ServerAdmin root@localhost
# DocumentRoot /var/www/html/
# ServerName subdomain57.domain.com
# ServerAlias subdomain57.domain.com
# ErrorLog /var/www/html/error.log
# RewriteCond %{SERVER_NAME} =subdomain57.domain.com
# RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
ServerName subdomain57.domain.com
Include /etc/letsencrypt/options-ssl-apache.conf
SSLCertificateFile /etc/letsencrypt/live/subdomain57.domain.com/cert.pem
SSLCertificateKeyFile /etc/letsencrypt/live/subdomain57.domain.com/privkey.pem
SSLCertificateChainFile /etc/letsencrypt/live/subdomain57.domain.com/chain.pem
</VirtualHost>
</IfModule>