首先你得有个域名以及https证书,网上有很多免费可以申请的,随便申请一个即可
server {
listen 433 ssl;
server_name localhost;
ssl_certificate cert.crt;
ssl_certificate_key cert.key;
ssl_trusted_certificate cert.crt;
ssl_session_cache shared:SSL:1m;
ssl_session_timeout 5m;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:HIGH:!aNULL:!MD5:!RC4:!DHE;
ssl_prefer_server_ciphers on;
#charset koi8-r;
#access_log logs/host.access.log main;
location / {
root ui;
try_files $uri $uri/ /index.html;
index index.html index.htm;
}
证书存储目录再conf目录下