Configure a free HTTs certificate for your website

Source: Internet
Author: User
Tags ssl certificate letsencrypt

Recently seen online say https's website Googlewill be prioritized, so take the time to record the process of configuring the blog.

Acme

Use LetEncrypt certificates as a way to implement your blog https .

acme.sh?? acme Protocol that can be letsencrypt generated from a free certificate.

GitHub https://github.com/Neilpang/acme.sh

Main steps:

    1. Installation? acme.sh
    2. Generate certificate
    3. Copy certificate to Nginx/apache or other services
    4. Update Certificate
    5. Update? acme.sh
    6. Test HTTPS
1. Installing acme.sh

Installation is simple, one command:

curl  https://get.acme.sh | sh

Both the normal user and the root user can be installed and used. The installation process takes the following steps:

    1. Install the acme.sh into your? Under the Homedirectory:
cd ~/.acme.sh/

and create one bash alias that is handy for your use:?alias acme.sh=~/.acme.sh/acme.sh

2). Automatically create for you cronjob , automatically detect all the Certificates 0:00 o ' Day, and if they expire and need to be updated, the certificate will be automatically updated.

2. Generate the certificate and complete the verification

acme.sh? The implementation? acme All authentication protocols supported by the Protocol. There are generally two ways to verify: http and dns verify.

This is the use of http authentication

cd ~/.acme.sh/yum install socat

If you haven't run any web services yet,? 80 ? The port is idle, then? acme.sh ? can also pretend to be a webserver , temporarily listen to 80 the port, complete the verification:

sh acme.sh  --issue -d www.souyunku.com   --standalone
3. copy/Installation Certificate

After the previous certificate is generated, the next step is to take the certificate copy to the place where it really needs to be used.

Note that the certificates that are generated by default are placed in the installation directory:? ~/.acme.sh/ , do not directly use files under this directory, for example: do not directly let nginx/apache the configuration file use this file. The files inside are used internally, and the directory structure may change.

mkdir -p /certscd /root/.acme.sh/www.souyunku.comcp www.souyunku.com.cer /certscp www.souyunku.com.key /certs

Configure Nginx

vim /usr/local/nginx/conf/nginx.conf

Configuring certificates

server {    listen 443;    ssl on;    ssl_certificate  /certs/www.souyunku.com.cer;    ssl_certificate_key  /certs/www.souyunku.com.key;}

httpRedirect tohttps

server {    listen       80;    server_name www.souyunku.com;    rewrite ^(.*) https://$server_name$1 permanent;}

Check the Nginx profile every time you modify it

/usr/local/nginx/sbin/nginx -t
4. Update the certificate

Currently the certificate is automatically updated after 60 days and you do not need any action. It's possible to shorten this time in the future, but it's all automatic and you don't have to worry about it.

5. Update acme.sh

Currently, the ACME protocol and the Letsencrypt CA are frequently updated, so acme.sh is also frequently updated to keep in sync.

Upgrade acme.sh to the latest version:

acme.sh --upgrade

If you don't want to upgrade manually, you can turn on automatic upgrades:

acme.sh  --upgrade  --auto-upgrade

After that, acme.sh is automatically kept up to date.

You can also turn off automatic Updates at any time:

acme.sh --upgrade  --auto-upgrade  0
6. Test HTTPS

Start Nginx

/usr/local/nginx/sbin/nginx

Browser access www.souyunku.com will automatically jump to https://www.souyunku.com

Finally, because the blog using the seven Qiniu http protocol cdn caused the static resources in the blog is not available, and finally the seven Qiniu static resources configuredhttps

Configuration steps

Click menu: Converged cdn--> Domain management--and HTTPS configuration

Click? SSL certificate Management-Https://portal.qiniu.com/certificate/ssl#cert, you can request or upload your own certificate on the SSL Certificate Services page.

    • Content (PEM format) corresponds to the certificate content *.cre suffix
    • The private key (PEM format) corresponds to the certificate content *.key suffix

Last click: Force HTTPS Access

The user's HTTP request is forced to jump to the HTTPS protocol for access after it is opened.

Contact
    • Peng Lei
    • Source: Http://www.ymq.io/2018/06/08/certs-https
    • Copyright belongs to the author, please specify the source of the reprint
    • WeChat: Focus on the public, "Search Cloud Library", focus on the development of technology research and knowledge sharing

Configure a free HTTs certificate for your website

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.