Teach you how to use netlify to implement automatic deployment of the front end + HTTPS

Source: Internet
Author: User

With more and more open source tools, especially nodejs to build a micro-server, the implementation of the front-end automation is more and more simple, it is possible to "10 line JS code + 10 Line SH script + set GitHub Webhook" can be achieved, but if you and I like, is "lazy" (here is the commendatory?? , even if they don't want to do it themselves, what should we do? This time I found this good tool-netlify, the following I would like to tell how it is very useful ^_^

First, use github or Gitlab login netlify

First, open the Netlify website (https://app.netlify.com/)

Then log in using GitHub or Gitlab account.

Second, according to the Github/gitlab warehouse to create a website

Click the new site from git button:

Depending on the platform of your warehouse, choose one of the following three options:

Select the warehouse you need to deploy:

Set deployment options, including three points:

    1. To deploy a branch (corresponding to the Branch to deploy):

      As the name implies is the branch of your git repository, the default selection is the Master branch

    2. Packaging commands (corresponding to the Build command):

      Is your packaging command, such as NPM run Build,gulp build, or, if it is already a static file, do not need to package the compilation, this column is not filled

    3. Packaged directory (corresponding to Publish directory):

      The directory in which the static files are located after the package command is executed, such as Dist,_site, if it is already a static file, this column is not filled

Click the Deploy Site button on the way after completion

Third, set the domain name, bind the domain name

After the second step, we can see that the automated deployment has started to run, and in a few long time, our site can already be accessed using the Netlify domain name, such as:

You can see that netlify has randomly generated a domain name for us under Netlify, where we can change its prefix and bind it to our own domain name:

>> Change the netlify domain name prefix:

First, click on the Site Settings button, then click on the Change Site name button below, then in the pop-up box, enter the name of the prefix you need to make changes, click Save, as shown in:

>> bind to your own domain name:

First, click on the Domain Settings button, then click the ADD Custom Domain button below, then enter the full domain name you want to bind in the pop-up box, click Save, as shown in:

This time will show! Check DNS configuration, because we have not set the domain name resolution to the Netlify server, so this time need to your own domain name of the corresponding service provider website login after the domain name needs to bind to add a CNAME resolution, The parsed host record is the corresponding netlify domain name value (this is codernie.netlify.com)

OK, you can use your own domain name to access your website in a moment.

Iv. generate HTTPS certificates for HTTPS access

In the fourth section of domain settings, you can see the HTTPS several characters:

Click on the Verify DNS configuration button to turn it into the green button below and then click:

Then click OK in the pop-up box, and after a while you can use HTTPS to access your station:

See their small station in front can have green security words, is not very cool, and very reassuring, no longer worry about operators in their own website hanging ads, ha ha ... Wait, is there something wrong:

Yes, there's no force jump Https,ok, go ahead.

V. Force HTTP Jump HTTPS access

In the fourth step Domain settings down a bit, you can see the force HTTPS, just click on the force HTTPS can be achieved, is not very convenient, such as:

Here, your website even if the user uses HTTP access, will also force jump to HTTPS access, this can be completely without the operator to your users "send red envelopes"!

Vi. setting redirect

Using Netlify to automate deployment and HTTPS write here, like on the point of praise.

Teach you how to use netlify to implement automatic deployment of the front end + HTTPS

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.