服务器使用nginx搭https
到控制台,找到我的证书,申请一个免费的证书

下载证书(nginx版本),并将证书文件上传到服务器nginx的配置目录中
我的:
/usr/soft/nginx/nginx-1.21.6/conf
修改配置文件server对象:主要是修改:ssl_certificate 和ssl_certificate_key的值,就是刚上传的证书文件
server {
listen 443 ssl;
server_tokens off;
keepalive_timeout 5;
root /usr/local/app; #填写您的网站根目录,例如:/usr/local/lighthouse/softwares/wordpress
index index.php index.html index.htm;
access_log logs/wordpress.log;
error_log logs/wordpress.error.log;
server_name ylaoliu.cn www.ylaoliu.cn; #填写您的证书绑定的域名,例如:www.cloud.tencent.com
ssl_certificate ylaoliu.cn_bundle.crt; #填写您的证书文件名称,例如:cloud.tencent.com_bundle.crt
ssl_certificate_key ylaoliu.cn.key; #填写您的私钥文件名称,例如:cloud.tencent.com.key
ssl_session_timeout 5m;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2; # 可参考此 SSL 协议进行配置
ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:HIGH:!aNULL:!MD5:!RC4:!DHE; #可按照此加密套件配置,写法遵循 openssl 标准
ssl_prefer_server_ciphers on;
location ~* \.php$ {
fastcgi_pass 127.0.0.1:9000;
include fastcgi.conf;
client_max_body_size 20m;
fastcgi_connect_timeout 30s;
fastcgi_send_timeout 30s;
fastcgi_read_timeout 30s;
fastcgi_intercept_errors on;
}
location / {
root html;
index index.html index.htm;
}
}
到objs目录下:./nginx -s reload