Created
August 12, 2019 16:45
-
-
Save samhagin/af062a7bec6bb6115a1ae319968cf8c4 to your computer and use it in GitHub Desktop.
Apache virtualhost definition and other instructions for installing SSL using acme.sh
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# mod_ssl | |
yum install mod_ssl | |
# virtualhost | |
<VirtualHost *:80> | |
ServerName www.codedemo.gq | |
ServerAlias codedemo.qg | |
DocumentRoot /var/www/codedemo.gq/html | |
ErrorLog /var/www/codedemo.gq/logs/error.log | |
CustomLog /var/www/codedemo.gq/logs/requests.log combined | |
#RewriteEngine On | |
#RewriteRule ^(.*)$ https://%{HTTP_HOST}$1 [R=301,L] | |
</VirtualHost> | |
# install acme | |
cd /root | |
curl https://get.acme.sh | sh | |
source ~/.bashrc | |
# generate a certificate | |
acme.sh --issue -d codedemo.gq -d www.codedemo.gq --webroot /var/www/codedemo.gq/html | |
mkdir -pv /etc/letsencrypt/codedemo.gq | |
# install certificate | |
acme.sh --install-cert --domain codedemo.gq --cert-file /etc/letsencrypt/codedemo.gq/codedemo.gq.cer --key-file /etc/letsencrypt/codedemo.gq/codedemo.gq.key --fullchain-file /etc/letsencrypt/codedemo.gq/fullchain.cer | |
# open port 443 | |
# SSL virtualhost | |
<VirtualHost *:443> | |
ServerName www.codedemo.gq | |
ServerAlias codedemo.gq | |
DocumentRoot /var/www/codedemo.gq/html | |
SSLEngine on | |
SSLCertificateFile /etc/letsencrypt/codedemo.gq/codedemo.gq.cer | |
SSLCertificateKeyFile /etc/letsencrypt/codedemo.gq/codedemo.gq.key | |
SSLCertificateChainFile /etc/letsencrypt/codedemo.gq/fullchain.cer | |
</VirtualHost> | |
# restart apache after ssl | |
systemctl restart httpd |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment