個人域名是在阿里雲萬網上購買的,服務器是部署在騰訊雲上,能夠按照下面的步驟配置httpsnginx
首先登錄阿里雲網站控制檯,申請免費證書,免費證書只能單一域名。測試地址如:https://gofly.sopans.com/web
申請稍等幾分鐘就能經過服務器
把證書下載到本地,而後上傳到騰訊雲的服務器上,配置nginx就能夠了websocket
nginx的配置以下,注意證書的地址和域名的配置,同時也能支持websocket wsssession
server { listen 443 ssl http2; ssl on; ssl_certificate conf.d/cert/4263285_gofly.sopans.com.pem; ssl_certificate_key conf.d/cert/4263285_gofly.sopans.com.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; #listen 80; server_name gofly.sopans.com; access_log /var/log/nginx/gofly.sopans.com.access.log main; location / { proxy_pass http://127.0.0.1:8081; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; proxy_set_header Origin ""; } } server{ listen 80; server_name gofly.sopans.com; access_log /var/log/nginx/gofly.sopans.com.access.log main; location / { proxy_pass http://127.0.0.1:8081; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; proxy_set_header Origin ""; } }