海康摄像头接入流媒体服务器&&实现https域名代理播放

环境

  1. 操作系统:Ubuntu 22.04
  2. 流媒体服务器:srs 官网安装教程
  3. srs开启GB28181协议 官网开启教程
  4. 进行海康摄像头的配置 官网配置教程
  5. srs使用systemctl实现开机自启 官网配置教程

nginx配置说明

bash 复制代码
server {
    listen 80;
    server_name a.com;
    return 301 https://$server_name$request_uri;
}
server {
    listen 60080 ssl;
    listen [::]:60080;
    server_name a.com;

    charset utf-8;

    # 安全相关
    server_tokens off;

    ssl_certificate      /fullchain.pem;
    ssl_certificate_key  /privatekey.pem;

    ssl_session_cache    shared:SSL:50m;
    ssl_session_timeout  5m;
    ssl_protocols        TLSv1 TLSv1.1 TLSv1.2;
    ssl_prefer_server_ciphers on;
    ssl_ciphers          "ECDHE-RSA-AES256-GCM-SHA384:ECDHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-SHA384:ECDHE-RSA-AES128-SHA256:ECDHE-RSA-AES256-SHA:ECDHE-RSA-AES128-SHA:DHE-RSA-AES256-SHA256:DHE-RSA-AES128-SHA256:DHE-RSA-AES256-SHA:DHE-RSA-AES128-SHA:ECDHE-RSA-DES-CBC3-SHA:EDH-RSA-DES-CBC3-SHA:AES256-GCM-SHA384:AES128-GCM-SHA256:AES256-SHA256:AES128-SHA256:AES256-SHA:AES128-SHA:DES-CBC3-SHA:HIGH:!aNULL:!eNULL:!EXPORT:!DES:!MD5:!PSK:!RC4";

    #location / {
	#	proxy_pass http://127.0.0.1:8080/; ## 重要!!!proxy_pass 需要设置为后端项目>所在服务器的 IP
	#	proxy_set_header Host $http_host;
	#	proxy_set_header X-Real-IP $remote_addr;
	#	proxy_set_header REMOTE-HOST $remote_addr;
	#	proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    #}
    
    # 转发 http://1.1.1.1:8080/live/34000001.flv
    #location /live {
    #   proxy_pass http://127.0.0.1:8080/live/; ## 重要!!!proxy_pass 需要设置为后端项目所在服务器的 IP
	#	proxy_set_header Host $http_host;
	#	proxy_set_header X-Real-IP $remote_addr;
	#	proxy_set_header REMOTE-HOST $remote_addr;
	#	proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

	#	types {
	#   	application/vnd.apple.mpegurl m3u8;
	#    	video/mp2t ts;
	#	}
    #}


    # For SRS homepage, console and players
    #   http://r.ossrs.net/console/
    #   http://r.ossrs.net/players/
    location ~ ^/(console|players)/ {
		proxy_pass http://127.0.0.1:8080/$request_uri;
    }

    # For SRS streaming, for example:
    #   http://r.ossrs.net/live/livestream.flv
    #   http://r.ossrs.net/live/livestream.m3u8
    location ~ ^/.+/.*\.(flv|m3u8|ts|aac|mp3)$ {
		proxy_pass http://127.0.0.1:8080$request_uri;
    }

    # For SRS backend API for console.
    # For SRS WebRTC publish/play API.
    location ~ ^/(api|rtc)/ {
		proxy_pass http://127.0.0.1:1985$request_uri;
    }
}

播放地址

https://a.com:60080/live/34000001.flv

https://a.com:60080/live/34000001.m3u8

相关推荐
天宇&嘘月1 天前
Nginx的https搭建
网络·nginx·https
rainmanqqst1 天前
C#Netcore支持Https
网络协议·http·https·c#
8***84821 天前
Nginx代理到https地址忽略证书验证配置
运维·nginx·https
a***11352 天前
用nginx正向代理https网站
运维·nginx·https
ILL11IIL2 天前
nginx的https的搭建
网络协议·http·https
2501_915106322 天前
iOS 抓不到包怎么办?从 HTTPS 代理排查到 TCP 数据流捕获的全链路解决方案
android·tcp/ip·ios·小程序·https·uni-app·iphone
游戏开发爱好者82 天前
APP上架苹果应用商店经验教训与注意事项
android·ios·小程序·https·uni-app·iphone·webview
我不是张鸭鸭2 天前
nginx的https的搭建
运维·nginx·https
2501_916007472 天前
苹果应用商店上架的系统逻辑,从产品开发到使用 开心上架 上架IPA 交付审核流程
android·ios·小程序·https·uni-app·iphone·webview
2501_916008892 天前
Python抓包HTTPS详解:Wireshark、Fiddler、Charles等工具使用教程
python·ios·小程序·https·uni-app·wireshark·iphone