OpenStreamingPlatform是一个开源的视频直播平台,可以用来搭建自己的直播网站。 功能方面还是挺全的,视频上传/直播/录制/聊天/用户控制/后台面板等等都有,唯一的不足就是我觉得UI好丑。。 手动部署方法可以看官方的文档: https://gitlab.com/Deamos/flask-nginx-rtmp-manager 下面使用docker来部署这个项目。 安装docker: apt -y update apt -y install curl curl -sSL https://get.docker.com/ | sh systemctl start docker systemctl enable docker 安装docker-compose: curl -L https://github.com/docker/compose/releases/download/1.25.4/docker-compose-`uname -s`-`uname -m` -o /usr/local/bin/docker-compose chmod +x /usr/local/bin/docker-compose 创建两个目录: mkdir -p /opt/traefik mkdir -p /opt/stream 创建acme.json: touch /opt/traefik/acme.json && chmod 600 /opt/traefik/acme.json 新建traefik的traefik.toml nano /opt/traefik/traefik.toml 写入如下配置: defaultEntryPoints = ["https","http"] [entryPoints] [entryPoints.http] address = ":80" [entryPoints.http.redirect] entryPoint = "https" [entryPoints.https] address = ":443" [entryPoints.https.tls] [acme] email = "[email protected]" storage = "acme.json" entryPoint = "https" onHostRule = true [acme.httpChallenge] entryPoint = "http" 注:替换邮箱[email protected]为你自己的。 新建traefik的docker-compose: nano /opt/traefik/docker-compose.yml 写入如下配置: version: '3.5' services: reverse-proxy: container_name: traefik image: traefik:v1.7 command: --api --docker ports: - "80:80" - "443:443" - "8080:8080" networks: - traefik volumes: - /var/run/docker.sock:/var/run/docker.sock - /opt/traefik/traefik.toml:/traefik.toml - /opt/traefik/acme.json:/acme.json networks: traefik: name: imlala 新建openstreamingplatform的docker-compose: nano /opt/stream/docker-compose.yml 写入如下配置: version: '3.5' services: openstram: container_name: openstream image: deamos/openstreamingplatform:latest ports: - 1935:1935 environment: - REDIS_HOST=redis-osp - FLASK_SECRET="" - FLASK_SALT="" - OSP_REQUIREVERIFICATION=False - OSP_ALLOWREGISTRATION=False labels: - "traefik.frontend.rule=Host:stream.233.fi" volumes: - ./data:/var/www - ./db:/opt/osp/db redis-osp: container_name: redis image: redis networks: default: external: name: imlala 注: 1.FLASK_SECRET/FLASK_SALT自己随便填写一点随机字符。 2.OSP_REQUIREVERIFICATION是关闭注册,如果需要注册功能去掉这行env。 3.OSP_ALLOWREGISTRATION是关闭注册用户邮箱验证,如果打开的话需要配置SMTP服务,为方便建议关掉。 4.stream.233.fi的域名替换为你自己的。 最后进到这两个项目目录up起来即可: docker-compose up -d 关于直播设置,首先要创建频道和直播key。 登录进去右上角点你的账户头像-My Channels-Create Channel 创建完成之后点下拉菜单-齿轮按钮,往下翻会有一个Stream Key。 OBS流设置如下图,rtsp/rtmp都可以: 测试: