Use Let's Encrypt to manually create an https Certificate

Source: Internet
Author: User

Use Let's Encrypt to manually create an https Certificate

Let's Encrypt is an open-source free SSL Certificate project initiated by Mozilla, Cisco, Akamai, IdenTrust, EFF, and other organizations. It is now hosted by the Linux Foundation.

This blog post describes how to use letsencrypt to successfully generate an ssl certificate on Linux Ubuntu.

1. Install letsencrypt

git clone https://github.com/letsencrypt/letsencryptcd letsencrypt./letsencrypt-auto --help

2. Generate a private key

openssl genrsa 4096 > x.cnblogs.com.key

3. Generate a CSR (Certificate Signing Reqeust)

Openssl req-new-sha256 \-key x.cnblogs.com. key \-subj "/C = CN/ST = province/L = city/O = Department/OU = Company/CN = x.cnblogs.com" \-reqexts SAN \-outform der \- config <(cat/etc/ssl/openssl. cnf \ <(printf "[SAN] \ nsubjectAltName = DNS: x.cnblogs.com") \-out x.cnblogs.com. csr

4. Initiate a request to the letsencrypt server to obtain the certificate

./letsencrypt-auto certonly \    --authenticator manual \    --server https://acme-v01.api.letsencrypt.org/directory --text \    --email x@cnblogs.com \    --csr x.cnblogs.com.csr

When "Press ENTER to continue" is displayed, do not move. Next step.

5. Verify the ownership of the domain name corresponding to the certificate
If the corresponding site is already running, you can create the URL/. well-known/acme-challenge/xxx so that the letsencrypt server can access this URL for verification.
If there is no corresponding site, you can use python to temporarily run the Web site for verification. refer to the following prompt:

Make sure your web server displays the following content athttp://x.cnblogs.com/.well-known/acme-challenge/xxx before continuing:xxxxxx...If you don't have HTTP server configured, you can run the followingcommand on the target server (as root):mkdir -p /tmp/letsencrypt/public_html/.well-known/acme-challengecd /tmp/letsencrypt/public_htmlprintf "%s" xxxxxx... > .well-known/acme-challenge/xxx# run only once per server:$(command -v python2 || command -v python2.7 || command -v python2.6) -c \"import BaseHTTPServer, SimpleHTTPServer; \s = BaseHTTPServer.HTTPServer(('', 80), SimpleHTTPServer.SimpleHTTPRequestHandler); \s.serve_forever()" 

6. Return to the operation window in step 1 and press the Enter key. If the certificate is successfully created, the following prompt will appear:

 - Congratulations! Your certificate and chain have been saved at ...

Then, the certificate file with the extension. pem is displayed in the current folder.

0000_cert.pem

WordPress enables HTTPS encryption for all blogs and uses the Let's Encrypt Certificate

This article permanently updates the link address:

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.