Skip to content

Commit 51cb321

Browse files
committed
Add RTMPS server.
1 parent 1f51ff8 commit 51cb321

File tree

18 files changed

+196
-26
lines changed

18 files changed

+196
-26
lines changed

i18n/en-us/docusaurus-plugin-content-docs/current/doc/http-api.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ http_api {
119119
# default: ./conf/server.key
120120
key ./conf/server.key;
121121
# The SSL public cert file, generated by:
122-
# openssl req -new -x509 -key server.key -out server.crt -days 3650 -subj "/C=CN/ST=Beijing/L=Beijing/O=Me/OU=Me/CN=ossrs.net"
122+
# openssl req -new -x509 -key server.key -out server.crt -days 3650 -subj "/C=CA/ST=Toronto/L=Toronto/O=Me/OU=Me/CN=ossrs.io"
123123
# default: ./conf/server.crt
124124
cert ./conf/server.crt;
125125
}
@@ -258,7 +258,7 @@ http_api {
258258
# default: ./conf/server.key
259259
key ./conf/server.key;
260260
# The SSL public cert file, generated by:
261-
# openssl req -new -x509 -key server.key -out server.crt -days 3650 -subj "/C=CN/ST=Beijing/L=Beijing/O=Me/OU=Me/CN=ossrs.net"
261+
# openssl req -new -x509 -key server.key -out server.crt -days 3650 -subj "/C=CA/ST=Toronto/L=Toronto/O=Me/OU=Me/CN=ossrs.io"
262262
# default: ./conf/server.crt
263263
cert ./conf/server.crt;
264264
}

i18n/en-us/docusaurus-plugin-content-docs/current/doc/http-server.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ http_server {
118118
# default: ./conf/server.key
119119
key ./conf/server.key;
120120
# The SSL public cert file, generated by:
121-
# openssl req -new -x509 -key server.key -out server.crt -days 3650 -subj "/C=CN/ST=Beijing/L=Beijing/O=Me/OU=Me/CN=ossrs.net"
121+
# openssl req -new -x509 -key server.key -out server.crt -days 3650 -subj "/C=CA/ST=Toronto/L=Toronto/O=Me/OU=Me/CN=ossrs.io"
122122
# Overwrite by env SRS_HTTP_SERVER_HTTPS_CERT
123123
# default: ./conf/server.crt
124124
cert ./conf/server.crt;

i18n/en-us/docusaurus-plugin-content-docs/current/doc/rtmp.md

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,19 @@ SRS supports converting RTMP to other protocols, described in next sections.
5050
The configuration about RTMP:
5151

5252
```bash
53+
# the rtmp listen ports, split by space, each listen entry is <[ip:]port>
54+
# for example, 192.168.1.100:1935 10.10.10.100:1935
55+
# where the ip is optional, default to 0.0.0.0, that is 1935 equals to 0.0.0.0:1935
56+
# Overwrite by env SRS_LISTEN
57+
listen 1935;
58+
# the default chunk size is 128, max is 65536,
59+
# some client does not support chunk size change,
60+
# however, most clients support it and it can improve
61+
# performance about 10%.
62+
# Overwrite by env SRS_CHUNK_SIZE
63+
# default: 60000
64+
chunk_size 60000;
65+
5366
vhost __defaultVhost__ {
5467
# whether enable min delay mode for vhost.
5568
# for min latency mode:
@@ -247,6 +260,78 @@ vhost __defaultVhost__ {
247260
> Note: These configurations are for publish and play. Note that there are some other configurations in other sections,
248261
for example, converting RTMP to [HTTP-FLV](./flv.md#config) or HTTP-TS.
249262

263+
## RTMPS
264+
265+
RTMPS (RTMP over SSL/TLS) provides secure RTMP streaming by encrypting the connection between clients and the server. This is essential for protecting sensitive content and ensuring secure communication in production environments.
266+
267+
SRS (v7.0.56+) supports RTMPS server functionality, allowing publishers and players to connect using encrypted RTMP connections.
268+
269+
To enable RTMPS, you need to configure SRS with SSL certificates and run it with RTMPS support:
270+
271+
```bash
272+
./objs/srs -c conf/rtmps.conf
273+
```
274+
275+
Publish RTMPS stream by [FFmpeg](https://ffmpeg.org/download.html):
276+
277+
```bash
278+
ffmpeg -re -i doc/source.flv -c copy -f flv rtmps://localhost:1443/live/livestream
279+
```
280+
281+
Play RTMPS stream by [ffplay](https://ffmpeg.org/download.html):
282+
283+
```bash
284+
ffplay rtmps://localhost:1443/live/livestream
285+
```
286+
287+
The RTMPS configuration requires SSL certificate setup similar to other HTTPS services in SRS:
288+
289+
```bash
290+
# the rtmp listen ports, split by space, each listen entry is <[ip:]port>
291+
# for example, 192.168.1.100:1935 10.10.10.100:1935
292+
# where the ip is optional, default to 0.0.0.0, that is 1935 equals to 0.0.0.0:1935
293+
# Overwrite by env SRS_LISTEN
294+
listen 1935;
295+
296+
# SSL configuration for RTMPS
297+
rtmps {
298+
# Whether rtmps is enabled.
299+
# Overwrite by env SRS_RTMPS_ENABLED
300+
# default: off
301+
enabled on;
302+
# The rtmps listen port
303+
# Overwrite by env SRS_RTMPS_LISTEN
304+
listen 1443;
305+
# The SSL private key file, generated by:
306+
# openssl genrsa -out server.key 2048
307+
# Overwrite by env SRS_RTMPS_KEY
308+
# default: ./conf/server.key
309+
key ./conf/server.key;
310+
# The SSL public cert file, generated by:
311+
# openssl req -new -x509 -key server.key -out server.crt -days 3650 -subj "/C=CA/ST=Toronto/L=Toronto/O=Me/OU=Me/CN=ossrs.io"
312+
# Overwrite by env SRS_RTMPS_CERT
313+
# default: ./conf/server.crt
314+
cert ./conf/server.crt;
315+
}
316+
317+
vhost __defaultVhost__ {
318+
# Standard RTMP vhost configuration applies to RTMPS as well
319+
}
320+
```
321+
322+
For testing purposes, you can generate a self-signed certificate:
323+
324+
```bash
325+
# Generate private key
326+
openssl genrsa -out server.key 2048
327+
328+
# Generate self-signed certificate
329+
openssl req -new -x509 -key server.key -out server.crt -days 3650 \
330+
-subj "/C=CN/ST=Beijing/L=Beijing/O=Me/OU=Me/CN=localhost"
331+
```
332+
333+
For production environments, use certificates from a trusted Certificate Authority (CA) or Let's Encrypt.
334+
250335
## On Demand Live Streaming
251336

252337
In some situations, you might want to start streaming only when someone starts watching:

i18n/zh-cn/docusaurus-plugin-content-docs/current/doc/http-api.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ http_api {
118118
# default: ./conf/server.key
119119
key ./conf/server.key;
120120
# The SSL public cert file, generated by:
121-
# openssl req -new -x509 -key server.key -out server.crt -days 3650 -subj "/C=CN/ST=Beijing/L=Beijing/O=Me/OU=Me/CN=ossrs.net"
121+
# openssl req -new -x509 -key server.key -out server.crt -days 3650 -subj "/C=CA/ST=Toronto/L=Toronto/O=Me/OU=Me/CN=ossrs.io"
122122
# default: ./conf/server.crt
123123
cert ./conf/server.crt;
124124
}
@@ -279,7 +279,7 @@ http_api {
279279
# default: ./conf/server.key
280280
key ./conf/server.key;
281281
# The SSL public cert file, generated by:
282-
# openssl req -new -x509 -key server.key -out server.crt -days 3650 -subj "/C=CN/ST=Beijing/L=Beijing/O=Me/OU=Me/CN=ossrs.net"
282+
# openssl req -new -x509 -key server.key -out server.crt -days 3650 -subj "/C=CA/ST=Toronto/L=Toronto/O=Me/OU=Me/CN=ossrs.io"
283283
# default: ./conf/server.crt
284284
cert ./conf/server.crt;
285285
}

i18n/zh-cn/docusaurus-plugin-content-docs/current/doc/http-server.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ http_server {
9090
# default: ./conf/server.key
9191
key ./conf/server.key;
9292
# The SSL public cert file, generated by:
93-
# openssl req -new -x509 -key server.key -out server.crt -days 3650 -subj "/C=CN/ST=Beijing/L=Beijing/O=Me/OU=Me/CN=ossrs.net"
93+
# openssl req -new -x509 -key server.key -out server.crt -days 3650 -subj "/C=CA/ST=Toronto/L=Toronto/O=Me/OU=Me/CN=ossrs.io"
9494
# Overwrite by env SRS_HTTP_SERVER_HTTPS_CERT
9595
# default: ./conf/server.crt
9696
cert ./conf/server.crt;
@@ -161,7 +161,7 @@ http_server {
161161
# default: ./conf/server.key
162162
key ./conf/server.key;
163163
# The SSL public cert file, generated by:
164-
# openssl req -new -x509 -key server.key -out server.crt -days 3650 -subj "/C=CN/ST=Beijing/L=Beijing/O=Me/OU=Me/CN=ossrs.net"
164+
# openssl req -new -x509 -key server.key -out server.crt -days 3650 -subj "/C=CA/ST=Toronto/L=Toronto/O=Me/OU=Me/CN=ossrs.io"
165165
# Overwrite by env SRS_HTTP_SERVER_HTTPS_CERT
166166
# default: ./conf/server.crt
167167
cert ./conf/server.crt;

i18n/zh-cn/docusaurus-plugin-content-docs/current/doc/rtmp.md

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,19 @@ SRS支持将RTMP转换成其他协议,下面会详细描述。
4747
RTMP协议相关配置如下:
4848

4949
```bash
50+
# the rtmp listen ports, split by space, each listen entry is <[ip:]port>
51+
# for example, 192.168.1.100:1935 10.10.10.100:1935
52+
# where the ip is optional, default to 0.0.0.0, that is 1935 equals to 0.0.0.0:1935
53+
# Overwrite by env SRS_LISTEN
54+
listen 1935;
55+
# the default chunk size is 128, max is 65536,
56+
# some client does not support chunk size change,
57+
# however, most clients support it and it can improve
58+
# performance about 10%.
59+
# Overwrite by env SRS_CHUNK_SIZE
60+
# default: 60000
61+
chunk_size 60000;
62+
5063
vhost __defaultVhost__ {
5164
# whether enable min delay mode for vhost.
5265
# for min latency mode:
@@ -243,6 +256,78 @@ vhost __defaultVhost__ {
243256

244257
> Note: 这里只是推流和拉流的配置,还有些其他的配置是在其他地方的,比如RTMP转[HTTP-FLV](./flv.md#config)或HTTP-TS等。
245258
259+
## RTMPS
260+
261+
RTMPS(基于SSL/TLS的RTMP)通过加密客户端和服务器之间的连接来提供安全的RTMP流传输。这对于保护敏感内容和确保生产环境中的安全通信至关重要。
262+
263+
SRS(v7.0.56+)支持RTMPS服务器功能,允许推流端和播放器使用加密的RTMP连接。
264+
265+
要启用RTMPS,您需要使用SSL证书配置SRS并运行RTMPS支持:
266+
267+
```bash
268+
./objs/srs -c conf/rtmps.conf
269+
```
270+
271+
使用[FFmpeg](https://ffmpeg.org/download.html)推送RTMPS流:
272+
273+
```bash
274+
ffmpeg -re -i doc/source.flv -c copy -f flv rtmps://localhost:1443/live/livestream
275+
```
276+
277+
使用[ffplay](https://ffmpeg.org/download.html)播放RTMPS流:
278+
279+
```bash
280+
ffplay rtmps://localhost:1443/live/livestream
281+
```
282+
283+
RTMPS配置需要SSL证书设置,类似于SRS中的其他HTTPS服务:
284+
285+
```bash
286+
# the rtmp listen ports, split by space, each listen entry is <[ip:]port>
287+
# for example, 192.168.1.100:1935 10.10.10.100:1935
288+
# where the ip is optional, default to 0.0.0.0, that is 1935 equals to 0.0.0.0:1935
289+
# Overwrite by env SRS_LISTEN
290+
listen 1935;
291+
292+
# SSL configuration for RTMPS
293+
rtmps {
294+
# Whether rtmps is enabled.
295+
# Overwrite by env SRS_RTMPS_ENABLED
296+
# default: off
297+
enabled on;
298+
# The rtmps listen port
299+
# Overwrite by env SRS_RTMPS_LISTEN
300+
listen 1443;
301+
# The SSL private key file, generated by:
302+
# openssl genrsa -out server.key 2048
303+
# Overwrite by env SRS_RTMPS_KEY
304+
# default: ./conf/server.key
305+
key ./conf/server.key;
306+
# The SSL public cert file, generated by:
307+
# openssl req -new -x509 -key server.key -out server.crt -days 3650 -subj "/C=CA/ST=Toronto/L=Toronto/O=Me/OU=Me/CN=ossrs.io"
308+
# Overwrite by env SRS_RTMPS_CERT
309+
# default: ./conf/server.crt
310+
cert ./conf/server.crt;
311+
}
312+
313+
vhost __defaultVhost__ {
314+
# Standard RTMP vhost configuration applies to RTMPS as well
315+
}
316+
```
317+
318+
对于测试目的,您可以生成自签名证书:
319+
320+
```bash
321+
# Generate private key
322+
openssl genrsa -out server.key 2048
323+
324+
# Generate self-signed certificate
325+
openssl req -new -x509 -key server.key -out server.crt -days 3650 \
326+
-subj "/C=CN/ST=Beijing/L=Beijing/O=Me/OU=Me/CN=localhost"
327+
```
328+
329+
对于生产环境,请使用来自受信任证书颁发机构(CA)或Let's Encrypt的证书。
330+
246331
## On Demand Live Streaming
247332

248333
有些场景下,是有需要播放时,才会邀请开始推流:

i18n/zh-cn/docusaurus-plugin-content-docs/version-4.0/doc/delivery-http-flv.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ http_server {
158158
# default: ./conf/server.key
159159
key ./conf/server.key;
160160
# The SSL public cert file, generated by:
161-
# openssl req -new -x509 -key server.key -out server.crt -days 3650 -subj "/C=CN/ST=Beijing/L=Beijing/O=Me/OU=Me/CN=ossrs.net"
161+
# openssl req -new -x509 -key server.key -out server.crt -days 3650 -subj "/C=CA/ST=Toronto/L=Toronto/O=Me/OU=Me/CN=ossrs.io"
162162
# default: ./conf/server.crt
163163
cert ./conf/server.crt;
164164
}

i18n/zh-cn/docusaurus-plugin-content-docs/version-4.0/doc/http-api.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ http_api {
9393
# default: ./conf/server.key
9494
key ./conf/server.key;
9595
# The SSL public cert file, generated by:
96-
# openssl req -new -x509 -key server.key -out server.crt -days 3650 -subj "/C=CN/ST=Beijing/L=Beijing/O=Me/OU=Me/CN=ossrs.net"
96+
# openssl req -new -x509 -key server.key -out server.crt -days 3650 -subj "/C=CA/ST=Toronto/L=Toronto/O=Me/OU=Me/CN=ossrs.io"
9797
# default: ./conf/server.crt
9898
cert ./conf/server.crt;
9999
}
@@ -254,7 +254,7 @@ http_api {
254254
# default: ./conf/server.key
255255
key ./conf/server.key;
256256
# The SSL public cert file, generated by:
257-
# openssl req -new -x509 -key server.key -out server.crt -days 3650 -subj "/C=CN/ST=Beijing/L=Beijing/O=Me/OU=Me/CN=ossrs.net"
257+
# openssl req -new -x509 -key server.key -out server.crt -days 3650 -subj "/C=CA/ST=Toronto/L=Toronto/O=Me/OU=Me/CN=ossrs.io"
258258
# default: ./conf/server.crt
259259
cert ./conf/server.crt;
260260
}

i18n/zh-cn/docusaurus-plugin-content-docs/version-5.0/doc/http-api.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ http_api {
118118
# default: ./conf/server.key
119119
key ./conf/server.key;
120120
# The SSL public cert file, generated by:
121-
# openssl req -new -x509 -key server.key -out server.crt -days 3650 -subj "/C=CN/ST=Beijing/L=Beijing/O=Me/OU=Me/CN=ossrs.net"
121+
# openssl req -new -x509 -key server.key -out server.crt -days 3650 -subj "/C=CA/ST=Toronto/L=Toronto/O=Me/OU=Me/CN=ossrs.io"
122122
# default: ./conf/server.crt
123123
cert ./conf/server.crt;
124124
}
@@ -279,7 +279,7 @@ http_api {
279279
# default: ./conf/server.key
280280
key ./conf/server.key;
281281
# The SSL public cert file, generated by:
282-
# openssl req -new -x509 -key server.key -out server.crt -days 3650 -subj "/C=CN/ST=Beijing/L=Beijing/O=Me/OU=Me/CN=ossrs.net"
282+
# openssl req -new -x509 -key server.key -out server.crt -days 3650 -subj "/C=CA/ST=Toronto/L=Toronto/O=Me/OU=Me/CN=ossrs.io"
283283
# default: ./conf/server.crt
284284
cert ./conf/server.crt;
285285
}

i18n/zh-cn/docusaurus-plugin-content-docs/version-5.0/doc/http-server.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ http_server {
128128
# default: ./conf/server.key
129129
key ./conf/server.key;
130130
# The SSL public cert file, generated by:
131-
# openssl req -new -x509 -key server.key -out server.crt -days 3650 -subj "/C=CN/ST=Beijing/L=Beijing/O=Me/OU=Me/CN=ossrs.net"
131+
# openssl req -new -x509 -key server.key -out server.crt -days 3650 -subj "/C=CA/ST=Toronto/L=Toronto/O=Me/OU=Me/CN=ossrs.io"
132132
# Overwrite by env SRS_HTTP_SERVER_HTTPS_CERT
133133
# default: ./conf/server.crt
134134
cert ./conf/server.crt;

0 commit comments

Comments
 (0)