-
Notifications
You must be signed in to change notification settings - Fork 0
/
srs_nginx_install_run.sh
59 lines (42 loc) · 1.84 KB
/
srs_nginx_install_run.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#!/bin/bash
# 在 Ubuntu 上安装 Nginx 和 RTMP 模块
sudo apt update
sudo apt upgrade
sudo apt install nginx
sudo apt install libnginx-mod-rtmp
# 更新 nginx 配置
## 参考:./nginx_conf/nginx.conf
sudo vi /etc/nginx/nginx.conf
# 下载 演示站点的 Web 页面包含播放器页面
git clone https://github.com/soldierxue/livestreaming
# 将页面复制到所配置的根目录中
sudo cp -r livestreaming/* /var/www/nwcdclub.cn/
# 启动 nginx 服务器
sudo systemctl restart nginx
#######################
# 安装 docker 以及 下载 srs-docker 相关配置
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
sudo apt-get update
apt-cache policy docker-ce
sudo apt-get install -y docker-ce
sudo systemctl status docker
# 将 普通用户 ubuntu 加入到 docker group
sudo usermod -aG docker ubuntu
# Logout & Login agagin to eanble ubuntu the access directly the docker commend
# check docker status
docker info
# download the demo files and configurations
git clone https://github.com/ossrs/srs-docker.git
# 获得 EC2 的 IPv4 的本地地址
HostIP=`curl http://169.254.169.254/latest/meta-data/local-ipv4/`
### 启动两个 HA 的服务器以及 Edge 服务器
docker run -d --rm -p 19350:19350 -p 9090:9090 --add-host=docker:${HostIP} \
-v `pwd`/srs-docker/conf/origin.cluster.serverA.conf:/usr/local/srs/conf/srs.conf \
ossrs/srs:3
docker run -d --rm -p 19351:19351 -p 9091:9091 --add-host=docker:${HostIP} \
-v `pwd`/srs-docker/conf/origin.cluster.serverB.conf:/usr/local/srs/conf/srs.conf \
ossrs/srs:3
docker run -d --rm -p 1935:1935 -p 1985:1985 -p 8080:8080 --add-host=docker:${HostIP} \
-v `pwd`/srs-docker/conf/origin.cluster.edge.conf:/usr/local/srs/conf/srs.conf \
ossrs/srs:3