It is recommended to use this script to specify that there are
Https://github.com/xdtianyu/scripts/tree/master/le-dns
It is implemented by invoking the DNS provider's API to update the TXT record, without specifying the site directory and DNS resolution, to support Dnspod and Cloudxns after the two service providers have finished reading this article with apachehttps://www.cloudxns.net/ Support/detail/id/906.html ============ I'm a split line =============
- Let's get a folder and put things.
Mkdir/usr/local/openssl
- Generate keys for accounts and websites
OpenSSL genrsa 4096 > Account.key
OpenSSL genrsa 4096 > Zhiyi.key
- Generate certificate
OpenSSL req-new-sha256-key zhiyi.key-subj "/"-reqexts San-config < (cat/etc/pki/tls/openssl.cnf < (printf "[SAN ]\nsubjectaltname=dns:snsproject.com,dns:www.snsproject.com ")) > ZHIYI.CSR
If you can not find OPENSSL.CNF, the first global search where this file, if not found on the installation of a OpenSSL
- Download a Python gadget
wget https://raw.githubusercontent.com/diafygi/acme-tiny/master/acme_tiny.py
- Run it, generate the signed CRT file for validation
Python./acme_tiny.py--account-key/account.key--csr/zhiyi.csr--acme-dir./www/acme-challenge/>/signed.crt
Note that it generates a file and then gets the file for validation through the http://yoursite.com/.well-known/acme-challenge/+ file name, so make sure that the file is accessible through the URL just now
6. After you have signed, generate a Web site certificate
Wget-o-HTTPS://LETSENCRYPT.ORG/CERTS/LETS-ENCRYPT-X1-CROSS-SIGNED.PEM > Intermediate.pem
Cat Signed.crt Intermediate.pem > Chained.pem
7. The deployment of the article please see the previous written
8. Because the certificate is valid for 90 days, the certificate script needs to be refreshed automatically
VI autorefresh.sh
#!/bin/bash
cd/usr/local/openssl/
Python./acme_tiny.py--account-key/account.key--csr/zhiyi.csr--acme-dir./www/acme-challenge/>/signed.crt
Wget-o-HTTPS://LETSENCRYPT.ORG/CERTS/LETS-ENCRYPT-X1-CROSS-SIGNED.PEM > Intermediate.pem
Cat Signed.crt Intermediate.pem > Chained.pem
Service httpd Restart
Vi/etc/crontab
Add a line at the end
0 0 4 * * root/usr/local/openssl/autorefresh.sh >/dev/null 2>&1
9. Set redirect HTTPS
Rewriteengine on
Rewritecond%{server_port}!^443$
Rewritecond%{request_uri}!^/.well-known
Rewriterule (. *) https://%{server_name}/$1 [l,r]
Let ' sencrypt certified website HTTPS configuration