1. First install nginx.
2. The automatic acquisition of the ssl certificate is achieved through the ssh service of linux. First, ensure that the ssh service and the ngxin service are normal. Then add two configuration files.
add default
server {
listen 80;
server_name _;
location /.well-known/ {
root /;
rewrite ^/.well-known/(.*)$ /.well-known/$1 break;
}
location =/ {
rewrite ^(.*)$ https://www.xxx.com;
}
}
rewrite ^/.well-known/(.*)$ /.well-known/$1 break;
Here is the configuration directory information uploaded from the https://www.sslforfree.com website. When it is automatically generated, two files will be uploaded to /.well-known. If the download is successful, a valid certificate will be generated.
3. Automatically generate certificates
In the generated certificate file, and then update the nginx certificate of the service, nginx -s reload can see the effect.