First create a directory cd /etc/nginx mkdir ssl cd ssl CA vs Self-signed Create a CA private key openssl genrsa -out ca.key 2048 Create a CA root certificate (public key) openssl req -new -x509 -days 3650 -key ca.key -out ca.crt Notice: 1. Common Name can be filled in at will Server Certificate Make a server-side private key: openssl genrsa -out server.pem 1024 openssl rsa -in server.pem -out server.key Generate a signing request: openssl req -new -key server.pem -out server.csr Notice: 1. Common Name must be filled in with the domain name when accessing the service. Here we use usb.dev. The following NGINX configuration will use Issued by CA openssl x509 -req -sha256 -in server.csr -CA ca.crt -CAkey ca.key -CAcreateserial -days 3650 -out server.crt Client Certificates Similar to the server certificate Notice: 1. Common Name can be filled in at will Now that the required certificates are in place, we can start configuring NGINX. Nginx Configuration server { listen 443; server_name usb.dev; index index.html; root /data/test/; ssl on; ssl_certificate /etc/nginx/ssl/server.crt; ssl_certificate_key /etc/nginx/ssl/server.key; ssl_client_certificate /etc/nginx/ssl/ca.crt; ssl_verify_client on; } Request Verification The verification process can be done on another machine or on the local machine. In order to resolve usb.dev, you also need to configure /etc/hosts: ip address usb.dev If you use a browser for authentication, you need to export the client certificate into p12 format. openssl pkcs12 -export -clcerts -in client.crt -inkey client.pem -out client.p12 Download several certificates from the server and install them to the trusted certificate list. Click the p12 file just generated and enter the certificate password to install it to the personal list. The above is the full content of this article. I hope it will be helpful for everyone’s study. I also hope that everyone will support 123WORDPRESS.COM. You may also be interested in:
|
<<: Detailed Introduction to the MySQL Keyword Distinct
>>: Mysql Sql statement comments
Basic Concepts Current read and snapshot read In ...
Preface When it comes to database transactions, a...
Because I wrote the word transition incorrectly i...
This article example shares the specific code of ...
Anchor tag usage: Linking to a specific location i...
Table of contents When declaring multiple variabl...
Vue routing this.route.push jump page does not re...
Analyze four common methods and principles: float...
Table of contents introduction 1. What is one-cli...
Elastic stack, commonly known as ELK stack, is a ...
Front-end project packaging Find .env.production ...
Today I found that a program inserted an incorrec...
Table of contents Global variable globalData Page...
1. Problem introduction Assume a scenario where a...
The test is passed in the nodejs environment. The...