Home > Operation and Maintenance > Nginx > How to configure Nginx to implement encryption certificate access

How to configure Nginx to implement encryption certificate access

王林
Release: 2023-05-13 15:07:06
forward
1534 people have browsed it

Enterprise Purpose:

Some enterprises require encryption of company data for security measures. Web encryption is also an important part, so you need to add a self-built certificate.

Install the certificate

The certificate remembers three types of files, the basic ca certificate and the second-level ca certificate (containing some company personal information, used to identify the owner of the certificate), and then use this certificate to generate Real certificate, distributed for use.

openssl genrsa -des3 -out ca.key 2048   #ca一级私钥(会让连续输入两次密码,切记要一样)
openssl req -new -key ca.key -out server.csr     #私钥为基础生成的2级加密文件(会让输入
私钥密码、CN 、BJ、BJ 、chuangye 、yunwei、cheng   402283866@qq.com  、回车、回车)
mv ca.key ca.key.org
openssl rsa -in ca.key.org -out ca.key      #删除ca私钥的密码(输入密码)。不然仓库访问有问题。nginx的原因。
#根据无密码的ca一级私钥+2级加密文件 生成证书
openssl x509 -req -days 36500 -in server.csr -signkey ca.key -out server.crt
chmod -R 777 ./*
Copy after login

nginx configuration file changes the

encrypted listening port, and adds the following parameters at the same level:

server {
listen 443 ssl http2;
listen [::]:443 ssl http2;
server_name _;
root /usr/share/nginx/html;

ssl on;
ssl_certificate "/root/ssl/server.crt";
ssl_certificate_key "/root/ssl/ca.key";
ssl_session_cache shared:SSL:1m;
ssl_session_timeout  10m;
ssl_ciphers HIGH:!aNULL:!MD5;
ssl_prefer_server_ciphers on;
 
}
Copy after login

The above is the detailed content of How to configure Nginx to implement encryption certificate access. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:yisu.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template