在http{ ... } 中间加入
# HTTPS server # server { listen 4343 ssl; server_name 域名; ssl_certificate D:/SoftWare/nginx-1.16.1/cert/Nginx/1.crt; ssl_certificate_key D:/SoftWare/nginx-1.16.1/cert/Nginx/2.key; ssl_session_cache shared:SSL:1m; ssl_session_timeout 5m; ssl_ciphers HIGH:!aNULL:!MD5; ssl_prefer_server_ciphers on; location / { proxy_pass http://localhost:8080; } # location / { # root html; # index index.html index.htm; # } }
1.crt和2.key 是从你从域名中下载一个免费一年证