海康摄像头接入流媒体服务器&&实现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

相关推荐
赤月奇3 天前
https改为http
数据挖掘·https·ssl
Boxsc_midnight5 天前
【windows电脑浏览器直接访问虚拟机或云端openclaw的方法】一个不需要HTTPS的安全连接通道(基于SSH)
windows·安全·https·openclaw
学不完的6 天前
haproxy
linux·运维·https·负载均衡·haproxy
Web极客码6 天前
在WordPress中启用http2
https·wordpress
清清&8 天前
【网络】一文读懂HTTPS协议
网络·https·智能路由器
猫头虎9 天前
web开发常见问题解决方案大全:502/503 Bad Gateway/Connection reset/504 timed out/400 Bad Request/401 Unauthorized
运维·前端·nginx·http·https·gateway·openresty
无籽西瓜a9 天前
SSL/TLS工作流程以及HTTP与HTTPS详解
http·https·ssl
橙露13 天前
计算机网络核心:HTTP/HTTPS 协议原理与抓包分析实战
计算机网络·http·https
小同志0014 天前
⽹络原理-HTTP/HTTPS(一)
网络协议·http·https
游戏开发爱好者814 天前
完整教程:App上架苹果App Store全流程指南
android·ios·小程序·https·uni-app·iphone·webview