nginxhls加密
发布时间: 2023-07-12 23:52:50
‘壹’ 如何在Nginx中添加SSL证书以支持HTTPS协议访问
获得Nginx环境SSL证书
安装流程:
环境检测,检测命令如下(测试nginx是否支持SSL)nginx-V
如果有输入 –with-http_ssl_mole 表示已编译openssl,支持安装ssl
如果没有安装请下载nginx源码重新编译:./configure--with-http_stub_status_mole--with-http_ssl_mole
make&&makeinstall配置Nginx
server{
listen80;
listen443ssl;
server_namewww.gworg.cn;
ssl_protocolsTLSv1.2TLSv1.1TLSv1;
ssl_certificate/etc/ssl/yourdomain.com.crt;
ssl_certificate_key/etc/ssl/yourdomain.com.key;
ssl_prefer_server_cipherson;
#自动跳转到HTTPS(可选)
if($server_port=80){
rewrite^(.*)$https://$host$1permanent;
}
location/{
root/home/web/;
indexindex.php;
}
}以上配置仅供参考,其他参数请根据生产环境需要添加。
安装后重启nginx使其生
解决办法:SSL证书可以在Gworg申请,然后根据以上文档安装,Nginx证书分为:crt公钥与key私钥2个文件。
热点内容