1、证书准备
本地调试,可以安装自签名证书,安装方法参考https本地自签名证书添加到信任证书访问
2、修改配置文件
将上面的配置文件拷贝到conf目录,添加或者修改节点如下
# HTTPS server server { listen 443 ssl; server_name www.aaa.com; ssl on; ssl_certificate www.aaa.com+5.pem; ssl_certificate_key www.aaa.com+5-key.pem; ssl_session_cache shared:SSL:1m; ssl_session_timeout 5m; ssl_ciphers HIGH:!aNULL:!MD5; ssl_prefer_server_ciphers on; #charset koi8-r; access_log logs/aiPlatform/access_log; error_log logs/aiPlatform/error_log error; location / { proxy_pass http://127.0.0.1:8111; proxy_redirect off; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; } location /api/asr { proxy_pass http://127.0.0.1:81/api/asr; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "Upgrade"; } location /api/tts { proxy_pass http://127.0.0.1:81/api/tts; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "Upgrade"; } }
以上会将基于ssl证书的websocket请求按照请求地址转发到本地服务的81端口上。
wss://www.aaa.com/api/asr转发到 127.0.0.1:81/api/asr
wss://www.aaa.com/api/tts转发到 127.0.0.1:81/api/tts