# Install acme.sh script | |
$ wget -O - https://get.acme.sh | sh -s email=contact@example.com | |
100 204k 100 204k 0 0 6394k 0 --:--:-- --:--:-- --:--:-- 6601k | |
[Thu Mar 11 10:53:29 UTC 2021] Installing from online archive. | |
[Thu Mar 11 10:53:29 UTC 2021] Downloading https://github.com/acmesh-official/acme.sh/archive/master.tar.gz | |
[Thu Mar 11 10:53:32 UTC 2021] Extracting master.tar.gz | |
[Thu Mar 11 10:53:32 UTC 2021] It is recommended to install socat first. | |
[Thu Mar 11 10:53:32 UTC 2021] We use socat for standalone server if you use standalone mode. | |
[Thu Mar 11 10:53:32 UTC 2021] If you don't use standalone mode, just ignore this warning. | |
[Thu Mar 11 10:53:32 UTC 2021] Installing to /root/.acme.sh | |
[Thu Mar 11 10:53:32 UTC 2021] Installed to /root/.acme.sh/acme.sh | |
[Thu Mar 11 10:53:32 UTC 2021] Installing alias to '/root/.bashrc' | |
[Thu Mar 11 10:53:32 UTC 2021] OK, Close and reopen your terminal to start using acme.sh | |
[Thu Mar 11 10:53:32 UTC 2021] Installing cron job | |
no crontab for root | |
no crontab for root | |
[Thu Mar 11 10:53:32 UTC 2021] Good, bash is found, so change the shebang to use bash as preferred. | |
[Thu Mar 11 10:53:33 UTC 2021] OK | |
[Thu Mar 11 10:53:33 UTC 2021] Install success! | |
$ apt-get install socat | |
$ cd .acme.sh | |
$ ./acme.sh --issue -d example.com -w /home/wwwroot/example.com | |
Or | |
$ ./acme.sh --issue -d example.com -d www.example.com -w /opt/lampp/htdocs/example.com | |
# Results | |
-----END CERTIFICATE----- | |
[Thu Mar 11 11:12:36 UTC 2021] Your cert is in /root/.acme.sh/example.com/holidaylandmark.com.cer | |
[Thu Mar 11 11:12:36 UTC 2021] Your cert key is in /root/.acme.sh/example.com/holidaylandmark.com.key | |
[Thu Mar 11 11:12:36 UTC 2021] The intermediate CA cert is in /root/.acme.sh/example.com/ca.cer | |
[Thu Mar 11 11:12:36 UTC 2021] And the full chain certs is there: /root/.acme.sh/example.com/fullchain.cer | |
# The certs will be placed in ~/.acme.sh/example.com/ | |
# The certs will be renewed automatically every 60 days. | |
$ cd holidaylandmark.com | |
$ cp example.com.cer example.com.key ca.cer /opt/lampp/etc/ssl/ | |
$ vi /opt/lampp/etc/extra/httpd-ssl.conf | |
SSLEngine on | |
SSLCertificateFile "/opt/lampp/etc/ssl/example.com.cer" | |
SSLCertificateKeyFile "/opt/lampp/etc/ssl/example.com.key" | |
SSLCACertificateFile "/opt/lampp/etc/ssl/ca.cer" | |
# Make sure you enable SSL in Apache. | |
$ vi /opt/lampp/etc/httpd.conf | |
RewriteEngine On | |
RewriteCond %{HTTP:X-Forwarded-Proto} =http | |
RewriteRule .* https://%{HTTP:Host}%{REQUEST_URI} [L,R=permanent] | |
# Secure (SSL/TLS) connections | |
<IfModule ssl_module> | |
# XAMPP | |
<IfDefine SSL> | |
Include etc/extra/httpd-ssl.conf | |
</IfDefine> | |
</IfModule> | |
# Make sure you redirect all non-https traffic to https | |
$ vi .htaccess | |
# BEGIN WordPress | |
<IfModule mod_rewrite.c> | |
RewriteEngine On | |
RewriteCond %{HTTPS} off | |
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301] | |
RewriteCond %{HTTP_HOST} !^www\. [NC] | |
RewriteRule (.*) https://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301] | |
Or | |
# Wordpress | |
# BEGIN WordPress | |
# The directives (lines) between "BEGIN WordPress" and "END WordPress" are | |
# dynamically generated, and should only be modified via WordPress filters. | |
# Any changes to the directives between these markers will be overwritten. | |
<IfModule mod_rewrite.c> | |
RewriteEngine On | |
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}] | |
RewriteBase /blog/ | |
RewriteRule ^index\.php$ - [L] | |
RewriteCond %{REQUEST_FILENAME} !-f | |
RewriteCond %{REQUEST_FILENAME} !-d | |
RewriteRule . /blog/index.php [L] | |
RewriteCond %{HTTPS} off | |
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301] | |
</IfModule> | |
# END WordPress |
Reference
https://github.com/acmesh-official/acme.sh
I’m a DevOps/SRE/DevSecOps/Cloud Expert passionate about sharing knowledge and experiences. I am working at Cotocus. I blog tech insights at DevOps School, travel stories at Holiday Landmark, stock market tips at Stocks Mantra, health and fitness guidance at My Medic Plus, product reviews at I reviewed , and SEO strategies at Wizbrand.
Please find my social handles as below;
Rajesh Kumar Personal Website
Rajesh Kumar at YOUTUBE
Rajesh Kumar at INSTAGRAM
Rajesh Kumar at X
Rajesh Kumar at FACEBOOK
Rajesh Kumar at LINKEDIN
Rajesh Kumar at PINTEREST
Rajesh Kumar at QUORA
Rajesh Kumar at WIZBRAND