1、从证书出售商获取证书文件,并复制到nginx的conf目录下
2、打开nginx.conf配置文件,写入以下代码
server { listen 443 ssl; server_name 域名; ssl_certificate pem证书本地地址; ssl_certificate_key key证书本地地址; ssl_session_timeout 5m; ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4; ssl_protocols TLSv1 TLSv1.1 TLSv1.2; ssl_prefer_server_ciphers on; location / { index index.html index.htm; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto $scheme; proxy_pass 转发的内网加端口; } }