mirror of
https://gitlab.crans.org/nounous/ghostream.git
synced 2024-12-22 15:02:19 +00:00
NGINX and OvenMediaEngine configuration
This commit is contained in:
commit
d9f6b5d044
19
README.md
Normal file
19
README.md
Normal file
@ -0,0 +1,19 @@
|
||||
# Ghostream
|
||||
|
||||
*Boooo!* A simple streaming server with authentication and open-source technologies.
|
||||
|
||||
![logo](doc/ghostream.svg)
|
||||
|
||||
## Installation
|
||||
|
||||
### NGINX
|
||||
|
||||
Copy [60-ghostream.conf module](doc/nginx/modules-available/60-ghostream.conf) to `/etc/nginx/modules-available/60-ghostream.conf`.
|
||||
|
||||
Copy [ghostream site](doc/nginx/sites-available/ghostream) to `/etc/nginx/sites-available/ghostream`.
|
||||
|
||||
### OvenMediaEngine
|
||||
|
||||
Copy [Server.xml](doc/ovenmediaengine/conf/Server.xml) to `/usr/share/ovenmediaengine/conf/Server.xml`.
|
||||
|
||||
Now enable and start OvenMediaEngine, `sudo systemctl enable --now ovenmediaengine`.
|
1
doc/ghostream.svg
Normal file
1
doc/ghostream.svg
Normal file
@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64" xmlns:v="https://vecta.io/nano"><path d="M42.23 46.232c14.047-2.364 18.734-9.9 20.117-19.726.776-5.46.697-9.927-.878-15.313 0 0-1.185 1.016-2.38 2.425l-1.806 2.13c-4.686-6.643-9.9-9.712-15.85-8.794s-7.133 4.81-10.582 10.696c-.19-.007-.97-.5-1.73-1.094-1.426-1.115-5.473-3.013-5.473-3.013 1.134 7.108 3.98 14.288 8.513 19.12 3.077 3.176 7.316 4.028 5.272 8.304-.912 1.907-4.373 1.573-5.327 1.582-.473.004-1.217.235-1.654.51-2.425 3.942 4.377 4.418 11.777 3.172z" fill="#ebe7e7" stroke="#b62525" stroke-width="2.214" stroke-linejoin="round"/><path d="M8.13 24.098v.005A7.55 7.55 0 0 0 .58 31.653a7.55 7.55 0 0 0 7.549 7.547c1.526 0 2.946-.456 4.135-1.237h9.408a4.52 4.52 0 0 0 4.518-4.518 4.52 4.52 0 0 0-4.518-4.518h-6.508c-1.092-2.824-3.826-4.828-7.036-4.828zm27.07 13.92l-12.494 4.028v6.245l12.494 2.685zM8.6 51.448v3.402h1.995L9.56 58.308h2.685l1.04-3.458h3.6l1.04 3.458h2.685l-1.04-3.458h1.53v-3.402z" fill="#214378"/><path d="M29.608 37.326H.072v14.772h29.537z" fill="#37abc8"/><path d="M35.075 19.044c.876-1.938 1.78-3.835 4.73-2.73m6.42-.858c2.54-2.016 4.207-1.66 5.38.037m-11.68 8.063c3.783 2.094 7.052.7 10.13-1.966" stroke="#b62525" fill="none" stroke-width="1.107" stroke-linecap="round"/></svg>
|
After Width: | Height: | Size: 1.2 KiB |
36
doc/nginx/modules-available/60-ghostream.conf
Normal file
36
doc/nginx/modules-available/60-ghostream.conf
Normal file
@ -0,0 +1,36 @@
|
||||
# This file is part of Ghostream
|
||||
# Copyright (C) 2020 by Crans <roots@crans.org>
|
||||
# SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
# Reverse RTMPS to RTMP
|
||||
# As the user may put a password in his stream key, we only expose RTMPS.
|
||||
stream {
|
||||
server {
|
||||
listen 1935 ssl;
|
||||
listen [::]:1935 ssl;
|
||||
|
||||
# Send to NGINX RTMP server
|
||||
proxy_pass 127.0.0.1:1925;
|
||||
|
||||
ssl_certificate /etc/letsencrypt/live/stream.crans.org/fullchain.pem;
|
||||
ssl_certificate_key /etc/letsencrypt/live/stream.crans.org/privkey.pem;
|
||||
ssl_protocols TLSv1.2 TLSv1.3;
|
||||
}
|
||||
}
|
||||
|
||||
# Authenticate then stream RTMP
|
||||
# This RTMP server will be used when clients play directly RTMPS.
|
||||
# It also push RTMP stream to OvenMediaEngine to generate WebRTC stream.
|
||||
rtmp {
|
||||
server {
|
||||
listen 127.0.0.1:1925;
|
||||
|
||||
chunk_size 4096;
|
||||
application app {
|
||||
live on;
|
||||
record off;
|
||||
push rtmp://127.0.0.1:1915;
|
||||
on_publish http://127.0.0.1:5000/;
|
||||
}
|
||||
}
|
||||
}
|
64
doc/nginx/sites-available/ghostream
Normal file
64
doc/nginx/sites-available/ghostream
Normal file
@ -0,0 +1,64 @@
|
||||
# This file is part of Ghostream
|
||||
# Copyright (C) 2020 by Crans <roots@crans.org>
|
||||
# SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
# Automatic Connection header for WebSocket support
|
||||
# See http://nginx.org/en/docs/http/websocket.html
|
||||
map $http_upgrade $connection_upgrade {
|
||||
default upgrade;
|
||||
'' close;
|
||||
}
|
||||
|
||||
# Redirect HTTP to HTTPS
|
||||
server {
|
||||
listen 80;
|
||||
listen [::]:80;
|
||||
|
||||
server_name stream.crans.org;
|
||||
|
||||
location / {
|
||||
return 301 https://$host$request_uri;
|
||||
}
|
||||
}
|
||||
|
||||
# HTTPS server
|
||||
server {
|
||||
listen 443 ssl http2;
|
||||
listen [::]:443 ssl http2;
|
||||
|
||||
server_name stream.crans.org;
|
||||
|
||||
# SSL configuration based on https://ssl-config.mozilla.org/
|
||||
ssl_certificate /etc/letsencrypt/live/stream.crans.org/fullchain.pem;
|
||||
ssl_certificate_key /etc/letsencrypt/live/stream.crans.org/privkey.pem;
|
||||
ssl_session_timeout 1d;
|
||||
ssl_session_cache shared:MozSSL:10m;
|
||||
ssl_session_tickets off;
|
||||
|
||||
# curl https://ssl-config.mozilla.org/ffdhe2048.txt > /etc/letsencrypt/dhparam
|
||||
ssl_dhparam /etc/letsencrypt/dhparam;
|
||||
|
||||
ssl_protocols TLSv1.2 TLSv1.3;
|
||||
ssl_ciphers ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384;
|
||||
ssl_prefer_server_ciphers off;
|
||||
|
||||
# HSTS (ngx_http_headers_module is required) (63072000 seconds)
|
||||
add_header Strict-Transport-Security "max-age=63072000" always;
|
||||
|
||||
# Log into separate log files
|
||||
access_log /var/log/nginx/ghostream.log;
|
||||
error_log /var/log/nginx/ghostream_error.log;
|
||||
|
||||
# Serve static HTML page with URL rewriting
|
||||
root /var/www/stream;
|
||||
try_files $uri $uri/ /index.html;
|
||||
|
||||
# Pass WebSocket to OvenMediaEngine for WebRTC signalling
|
||||
location /app/ {
|
||||
proxy_pass http://127.0.0.1:3333;
|
||||
proxy_redirect off;
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Connection $connection_upgrade;
|
||||
}
|
||||
}
|
75
doc/ovenmediaengine/conf/Server.xml
Normal file
75
doc/ovenmediaengine/conf/Server.xml
Normal file
@ -0,0 +1,75 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
|
||||
<Server version="7">
|
||||
<Name>OvenMediaEngine</Name>
|
||||
<Type>origin</Type>
|
||||
<IP>127.0.0.1</IP>
|
||||
|
||||
<Bind>
|
||||
<Providers>
|
||||
<RTMP>
|
||||
<Port>1915</Port>
|
||||
</RTMP>
|
||||
</Providers>
|
||||
<Publishers>
|
||||
<WebRTC>
|
||||
<Signalling>
|
||||
<Port>3333</Port>
|
||||
</Signalling>
|
||||
<IceCandidates>
|
||||
<IceCandidate>*:10000-10005/udp</IceCandidate>
|
||||
</IceCandidates>
|
||||
</WebRTC>
|
||||
</Publishers>
|
||||
</Bind>
|
||||
|
||||
<VirtualHosts>
|
||||
<VirtualHost>
|
||||
<Name>default</Name>
|
||||
<Domain>
|
||||
<Names>
|
||||
<Name>*</Name>
|
||||
</Names>
|
||||
</Domain>
|
||||
<Applications>
|
||||
<Application>
|
||||
<Name>app</Name>
|
||||
<Type>live</Type>
|
||||
<Encodes>
|
||||
<Encode>
|
||||
<Name>opus_only</Name>
|
||||
<Audio>
|
||||
<Codec>opus</Codec>
|
||||
<Bitrate>128000</Bitrate>
|
||||
<Samplerate>48000</Samplerate>
|
||||
<Channel>2</Channel>
|
||||
</Audio>
|
||||
<Video>
|
||||
<Bypass>true</Bypass>
|
||||
</Video>
|
||||
</Encode>
|
||||
</Encodes>
|
||||
<Streams>
|
||||
<Stream>
|
||||
<Name>${OriginStreamName}</Name>
|
||||
<Profiles>
|
||||
<Profile>opus_only</Profile>
|
||||
</Profiles>
|
||||
</Stream>
|
||||
</Streams>
|
||||
<Providers>
|
||||
<RTMP>
|
||||
<BlockDuplicateStreamName>true</BlockDuplicateStreamName>
|
||||
</RTMP>
|
||||
</Providers>
|
||||
<Publishers>
|
||||
<ThreadCount>2</ThreadCount>
|
||||
<WebRTC>
|
||||
<Timeout>30000</Timeout>
|
||||
</WebRTC>
|
||||
</Publishers>
|
||||
</Application>
|
||||
</Applications>
|
||||
</VirtualHost>
|
||||
</VirtualHosts>
|
||||
</Server>
|
Loading…
Reference in New Issue
Block a user