Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to upgrade the website from http to https

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/03 Report--

This article mainly explains "how to upgrade the website from http to https". The content in the article is simple and clear, easy to learn and understand. Please follow the editor's train of thought to study and learn "how to upgrade the website from http to https".

The noun explains:

What are HTTP and HTTPS?

HTTP protocol (Hypertext transfer Protocol) is the most widely used network protocol on the Internet, which is often used to transmit information between web browsers and website servers. Http protocol transmits data in clear text. If it is intercepted midway, the information can be read. I still remember that the login interface of one of the company's medical devices was intercepted and the page was full of advertisements.

In order to solve this defect of HTTP protocol, HTTPS protocol (secure socket layer hypertext transfer protocol) is extended. HTTPS adds SSL protocol on the basis of HTTP. SSL relies on certificates to verify the identity of the server and encrypt the communication data between the web browser and the server.

There are two main functions of HTTPS protocol:

Establish an information security channel to ensure the security of data transmission.

Confirm the authenticity of the website.

What's the difference between HTTP and HTTPS?

Https protocol needs to apply for a certificate from ca. Generally, there are few free certificates, so it costs a certain fee.

Http is a hypertext transfer protocol, information is plaintext transmission, and https is a secure ssl encrypted transmission protocol.

Http and https use completely different connections and different ports, the former being 80 and the latter 443.

The connection of http is very simple and stateless. HTTPS protocol is a network protocol built by SSL+HTTP protocol for encrypted transmission and identity authentication.

Certificate request process:

1: both Aliyun and Tencent Cloud have free certificates. (note: because brother Kai is on record in Aliyun. So I applied for it based on AliYun. )

2: log in to Aliyun-console-products and Services-search SSL. As shown below:

Editing

Click SSL Certificate (apply Security) and go to the purchase page. As shown below:

Editing

Select: cloud Shield Certificate Resource Pack. As shown below:

Editing

Select the free certificate expansion package. As shown below:

Editing

Description: you can get a free certificate package with a quantity of 20 in a natural year. At the end of the natural year, it will be cleared automatically. Every natural year is December 31, 24:00.

Buy now:

Editing

After the purchase is successful, wait for the administrative console:

Editing

You can see the certificate resource package. Then click Certificate request, and you can see a new piece of data in the certificate management list below. As shown below:

Editing

Then click Certificate request. Will open and fill in the application. As shown below:

Editing

Description:

Certificate binding domain name: the domain name you need to bind

Contact and location, after you choose, you can. The way CRS is generated does not need to be modified.

After filling in, you will enter the verification information. As shown below:

Editing

Because in the previous step [the CRS generation method does not need to be modified] we did not choose to do so manually. Therefore, it can be submitted for review directly.

It's quick to submit for review. It's only 1-2 minutes. As shown below:

Editing

After selecting the domain name that needs to be deployed, select download. The certificate for the specific deployment method is opened. Then select the corresponding download. Because brother Kai is using Nginx. So what I downloaded is Nginx. As shown below:

Editing

What is downloaded is a zip package. After unzipping the compressed package, you can get the corresponding two files ending in PEM and KEY. As shown below:

Editing

Nginx deployment:

Upload certificate:

Upload two unzipped files to the server.

Such as brother Kai's upload directory: / usr/local/nginx/ssl/lingquan

Explanation: lingquan is one of the websites of Kaige. If there are more than one can be distinguished in this way.

Configure in the configuration file of Nginx:

Because brother Kai uses pagoda panels. So modify it between the corresponding websites on the pagoda panel. As shown below:

Editing

If there is no server node added for 443s. If so, configure as follows:

Server {

Listen 443 ssl

Server_name your domain name

Root your project root

Index index.html

Ssl_certificate / usr/local/nginx/ssl/xxx/xxx.pem

Ssl_certificate_key / usr/local/nginx/ssl/xxx/xxx.key

Ssl_session_timeout 5m

Ssl_protocols TLSv1 TLSv1.1 TLSv1.2

Ssl_ciphers AESGCM all rig "DHV" export "RC4"HIGH"MEDIUM"LOW"aNULLL"enull"

Ssl_prefer_server_ciphers on

}

As shown below:

Editing

Description:

Ssl_certificate: is the absolute path to the PEM file

Ssl_certificate_key: is the absolute path to the KEY file.

After the configuration is complete, restart Nginx. And then verify. Use https to access your domain name.

Verify that the configuration is successful

Editing

Editing

You can see that when using https access, there is a small green lock. It indicates that the configuration is successful.

Http forces the jump to the https configuration:

Sometimes we need to force http access to https. The configuration is as follows:

Server {

Listen 80

Server_name, you go to the domain name

Return 301 https://$host$request_uri;

}

Thank you for your reading, the above is the content of "how to upgrade the website from http to https". After the study of this article, I believe you have a deeper understanding of how to upgrade the website from http to https, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report