


Teach you step by step how to enable https and http2 for your site (with code)
In the previous article "A brief analysis of the installation and use of nginx (Collection)", I introduced you to the installation and use of nginx. The following article will introduce to you how to enable https and http2 for the site. Let's see how to do it together.
This article mainly introduces how to enable https
and http2
# for the site
https and
http2
https for the site. Simply take this site
Linux nginx as an example
1
2
wget https:
//dl.eff.org/certbot-auto
chmod
a+x certbot-auto
Copy after login
automatically associate to 1 2 |
|
nginx
1
2
3
4
$sudo
./certbot-auto --nginx
```sh
## 检查证书有没有过期
Copy after login
1 2 3 4 |
|
$sudo ./certbot-auto renew --dry-run
1 2 3 4 |
|
If the following error code is prompted
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 5: ordinal not in range(128) is because the configuration file of
nginx contains Chinese characters, so change the Chinese to English That’s it
1 |
|
nginxConfiguration and take a look
1 2 3 4 5 6 7 8 9 10 11 12 |
|
Note that the nginx version is too low If it cannot be opened, you must first upgrade the nginx version, taking centos as an exampleModify the nginx of
/etc/yum.repos.d/nginx.repoWarehouse address
1 2 3 4 5 |
|
If nginx has not been installed, directly execute yum install nginx. If it has been installed, you can upgrade it through yum clean all && yum update nginx.It is recommended to stop
nginxViolent stop
killall nginx, then uninstall
yum remove nginx and then reinstall
yum install nginx
Ubuntu/Debian upgrade HTTP/2
First modifyaptwarehouse source
/etc/apt/ For the address of source.list, add the following two lines of warehouse.
1 2 |
|
1 |
|
https is successfully opened,
443 ssl The one behind
http2, that is, it is turned on
http2
1 |
|
https is successfully opened
http2 is turned on? Open the URL to be verified and wait until it is loaded. Then open a new
tab and enter
chrome://net-internals /#http2Enter
The above is the detailed content of Teach you step by step how to enable https and http2 for your site (with code). For more information, please follow other related articles on the PHP Chinese website!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics











Understand the meaning of HTTP 301 status code: common application scenarios of web page redirection. With the rapid development of the Internet, people's requirements for web page interaction are becoming higher and higher. In the field of web design, web page redirection is a common and important technology, implemented through the HTTP 301 status code. This article will explore the meaning of HTTP 301 status code and common application scenarios in web page redirection. HTTP301 status code refers to permanent redirect (PermanentRedirect). When the server receives the client's

PHP and Vue: a perfect pairing of front-end development tools. In today's era of rapid development of the Internet, front-end development has become increasingly important. As users have higher and higher requirements for the experience of websites and applications, front-end developers need to use more efficient and flexible tools to create responsive and interactive interfaces. As two important technologies in the field of front-end development, PHP and Vue.js can be regarded as perfect tools when paired together. This article will explore the combination of PHP and Vue, as well as detailed code examples to help readers better understand and apply these two

As a fast and efficient programming language, Go language is widely popular in the field of back-end development. However, few people associate Go language with front-end development. In fact, using Go language for front-end development can not only improve efficiency, but also bring new horizons to developers. This article will explore the possibility of using the Go language for front-end development and provide specific code examples to help readers better understand this area. In traditional front-end development, JavaScript, HTML, and CSS are often used to build user interfaces

How to implement HTTP streaming in C++? Create an SSL stream socket using Boost.Asio and the asiohttps client library. Connect to the server and send an HTTP request. Receive HTTP response headers and print them. Receives the HTTP response body and prints it.

In front-end development interviews, common questions cover a wide range of topics, including HTML/CSS basics, JavaScript basics, frameworks and libraries, project experience, algorithms and data structures, performance optimization, cross-domain requests, front-end engineering, design patterns, and new technologies and trends. . Interviewer questions are designed to assess the candidate's technical skills, project experience, and understanding of industry trends. Therefore, candidates should be fully prepared in these areas to demonstrate their abilities and expertise.

The HTTP request times out, and the server often returns the 504GatewayTimeout status code. This status code indicates that when the server executes a request, it still fails to obtain the resources required for the request or complete the processing of the request after a period of time. It is a status code of the 5xx series, which indicates that the server has encountered a temporary problem or overload, resulting in the inability to correctly handle the client's request. In the HTTP protocol, various status codes have specific meanings and uses, and the 504 status code is used to indicate request timeout issues. in customer

Combination of Golang and front-end technology: To explore how Golang plays a role in the front-end field, specific code examples are needed. With the rapid development of the Internet and mobile applications, front-end technology has become increasingly important. In this field, Golang, as a powerful back-end programming language, can also play an important role. This article will explore how Golang is combined with front-end technology and demonstrate its potential in the front-end field through specific code examples. The role of Golang in the front-end field is as an efficient, concise and easy-to-learn

Implementation steps: 1. Monitor the scroll event of the page; 2. Determine whether the page has scrolled to the bottom; 3. Load the next page of data; 4. Update the page scroll position.
