DEV Community

Discussion on: How To Setup Nginx For HLS Video Streaming On Centos 7

Collapse
 
lblanks240 profile image
lblanks240

i finally downloaded the module but now i get i have put this plugin in several places i am not sure what to do

Lenard

configuring additional modules
adding module in ../nginx-rtmp-module
./configure: error: no ../nginx-rtmp-module/config was found
[root@server nginx-1.17.0]# ls
auto conf html man README
CHANGES configure LICENSE nginx-rtmp-module.git src
CHANGES.ru contrib Makefile objs

Collapse
 
samuyi profile image
Samuyi

check the path specified for the cloned module and make sure the module was cloned without any errors. The config file that caused the error is located on the project root directory on github. So i suggest you make sure the path specified is the correct path to the module.

Thread Thread
 
lblanks240 profile image
lblanks240

what will be the best way to get this file without errors?

Thread Thread
 
lblanks240 profile image
lblanks240

i had to use wget to get the file

Thread Thread
 
lblanks240 profile image
lblanks240

i was wondering if you could please let me know if i got the conf file correct

thanks
lenard

* @version 1.8.10

* @package Engintron for cPanel/WHM

* @author Fotis Evangelou

* @url engintron.com

* @copyright Copyright (c) 2010 - 2018 Nuevvo Webware P.C. All rights reserved.

* @license GNU/GPL license: gnu.org/copyleft/gpl.html

*/

user nginx;
pid /var/run/nginx.pid;

worker_processes auto;
worker_rlimit_nofile 65535;
server_tokens off;

events {
multi_accept on;
use epoll;
worker_connections 65535;
}

We need to setup an rmtp server to stream video from client devices

rtmp {
server {
listen 1935;
chunk_size 4096;
ping 30s;
notify_method get;
allow play all;
# rmtp handler our clients connect to for live streaming, it runs on port 1935. It converts the stream to HLS and stores it on our server
application app {
live on;
hls on;

hls_path /var/www/hls/live;
hls_nested on; # create a new folder for each stream
record_notify on;
record_path /var/www/videos;
record all;
record_unique on;
}

application vod {
   play /var/www/videos;
}

}
}

http {
## Basic Settings ##
client_body_buffer_size 128k;
client_body_timeout 30s; # Use 5s for high-traffic sites
client_header_timeout 30s; # Use 5s for high-traffic sites
client_max_body_size 1024m;
keepalive_timeout 20s;
port_in_redirect off;
sendfile on;
server_names_hash_bucket_size 512;
server_name_in_redirect off;
server_tokens off;
tcp_nodelay on;
tcp_nopush on;
types_hash_max_size 2048;
include mime.types;
default_type application/octet-stream;
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
sendfile on;
tcp_nopush on;
keepalive_timeout 65;
gzip on;
server {
listen 80;
server_name _;
location / {
root html;
index index.html index.htm;
}
# the http end point our web based users connect to see the live stream
location /live {
types {
application/vnd.apple.mpegurl m3u8;
}
alias /var/www/hls/live;
add_header Cache-Control no-cache;
}
}include mime.types;
default_type application/octet-stream;
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
sendfile on;
tcp_nopush on;
keepalive_timeout 65;
gzip on;
server {
listen 80;
server_name _;
location / {
root html;
index index.html index.htm;
}
# the http end point our web based users connect to see the live stream
location /live {
types {
application/vnd.apple.mpegurl m3u8;
}
alias /var/www/hls/live;
add_header Cache-Control no-cache;
}
}

Thread Thread
 
lblanks240 profile image
lblanks240 • Edited

i really need some help i crashed my server i messed something in the conf file up. here is a copy of the logs.

thanks
lenard

[root@server ~]# ffmpeg -i input.mp4 output.avi
ffmpeg version N-90389-g72bb955625 Copyright (c) 2000-2018 the FFmpeg developers
built with gcc 4.8.5 (GCC) 20150623 (Red Hat 4.8.5-16)
configuration: --prefix=/usr/local/ffmpegtoolkit --pkg-config-flags=--static --extra-libs=-lpthread --enable-gpl --enable-shared --enable-nonfree --enable-pthreads --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libmp3lame --enable-libvpx --enable-libfdk-aac --enable-libfreetype --enable-libtheora --enable-libvorbis --enable-libx264 --enable-libx265 --enable-libxvid --enable-postproc --enable-swscale --enable-avfilter --enable-libass --enable-runtime-cpudetect --extra-cflags=-I/usr/local/ffmpegtoolkit/include/ --extra-ldflags=-L/usr/local/ffmpegtoolkit/lib --enable-version3
libavutil 56. 11.100 / 56. 11.100
libavcodec 58. 14.100 / 58. 14.100
libavformat 58. 10.100 / 58. 10.100
libavdevice 58. 2.100 / 58. 2.100
libavfilter 7. 13.100 / 7. 13.100
libswscale 5. 0.102 / 5. 0.102
libswresample 3. 0.101 / 3. 0.101
libpostproc 55. 0.100 / 55. 0.100
input.mp4: No such file or directory
[root@server ~]# sudo systemctl stop nginx
[root@server ~]# sudo systemctl restart nginx
Job for nginx.service failed because the control process exited with error code. See "systemctl status nginx.service" and "journalctl -xe" for details.
[root@server ~]# journalctl -xe
Jun 15 08:03:40 server.1xxxhost.net sshd[39155]: Disconnected from 82.196.15.195 port 60082 [preauth]
Jun 15 08:03:53 server.1xxxhost.net kernel: Firewall: TCP_IN Blocked IN=eth0 OUT= MAC=00:16:3e:5d:bc:26:88:75:56:3c:e
Jun 15 08:03:56 server.1xxxhost.net kernel: Firewall: CC_DENY IN=eth0 OUT= MAC=00:16:3e:5d:bc:26:88:75:56:3c:e8:c0:08
Jun 15 08:03:59 server.1xxxhost.net kernel: Firewall: TCP_IN Blocked IN=eth0 OUT= MAC=00:16:3e:5d:bc:26:88:75:56:3c:e
Jun 15 08:04:01 server.1xxxhost.net systemd[1]: Started Session 8399 of user root.
-- Subject: Unit session-8399.scope has finished start-up
-- Defined-By: systemd

-- Support: lists.freedesktop.org/mailman/list...

-- Unit session-8399.scope has finished starting up.

-- The start-up result is done.
Jun 15 08:04:01 server.1xxxhost.net systemd[1]: Started Session 8400 of user root.
-- Subject: Unit session-8400.scope has finished start-up
-- Defined-By: systemd

-- Support: lists.freedesktop.org/mailman/list...

-- Unit session-8400.scope has finished starting up.

-- The start-up result is done.
Jun 15 08:04:01 server.1xxxhost.net CROND[39169]: (root) CMD (/usr/local/cpanel/whostmgr/bin/dnsqueue > /dev/null 2>&1)
Jun 15 08:04:01 server.1xxxhost.net CROND[39170]: (root) CMD (/etc/nginx/utilities/https_vhosts.sh >> /dev/null 2>&1)
Jun 15 08:04:04 server.1xxxhost.net kernel: Firewall: TCP_IN Blocked IN=eth0 OUT= MAC=00:16:3e:5d:bc:26:88:75:56:3c:e
Jun 15 08:04:05 server.1xxxhost.net kernel: Firewall: TCP_IN Blocked IN=eth0 OUT= MAC=00:16:3e:5d:bc:26:88:75:56:3c:e
Jun 15 08:04:07 server.1xxxhost.net kernel: Firewall: TCP_IN Blocked IN=eth0 OUT= MAC=00:16:3e:5d:bc:26:88:75:56:3c:e
Jun 15 08:04:32 server.1xxxhost.net kernel: Firewall: TCP_IN Blocked IN=eth0 OUT= MAC=00:16:3e:5d:bc:26:88:75:56:3c:e
Jun 15 08:04:35 server.1xxxhost.net sudo[39200]: root : TTY=pts/0 ; PWD=/root ; USER=root ; COMMAND=/bin/systemctl
Jun 15 08:04:35 server.1xxxhost.net sudo[39200]: pam_unix(sudo:session): session opened for user root by root(uid=0)
Jun 15 08:04:35 server.1xxxhost.net kernel: Firewall: CC_DENY IN=eth0 OUT= MAC=00:16:3e:5d:bc:26:88:75:56:3c:e8:c0:08
Jun 15 08:04:35 server.1xxxhost.net polkitd[2391]: Registered Authentication Agent for unix-process:39201:23422165 (sys
Jun 15 08:04:35 server.1xxxhost.net systemd[1]: Starting nginx - high performance web server...
-- Subject: Unit nginx.service has begun start-up
-- Defined-By: systemd

-- Support: lists.freedesktop.org/mailman/list...

-- Unit nginx.service has begun starting up.
Jun 15 08:04:35 server.1xxxhost.net nginx[39207]: nginx: [emerg] unknown directive "includon" in /etc/nginx/nginx.conf:
Jun 15 08:04:35 server.1xxxhost.net systemd[1]: nginx.service: control process exited, code=exited status=1
Jun 15 08:04:35 server.1xxxhost.net systemd[1]: Failed to start nginx - high performance web server.
-- Subject: Unit nginx.service has failed
-- Defined-By: systemd

-- Support: lists.freedesktop.org/mailman/list...

-- Unit nginx.service has failed.

-- The result is failed.
Jun 15 08:04:35 server.1xxxhost.net systemd[1]: Unit nginx.service entered failed state.
Jun 15 08:04:35 server.1xxxhost.net systemd[1]: nginx.service failed.
Jun 15 08:04:35 server.1xxxhost.net polkitd[2391]: Unregistered Authentication Agent for unix-process:39201:23422165 (s
Jun 15 08:04:35 server.1xxxhost.net sudo[39200]: pam_unix(sudo:session): session closed for user root
Jun 15 08:04:37 server.1xxxhost.net kernel: Firewall: UDP_OUT Blocked IN= OUT=eth0 SRC=205.251.153.170 DST=104.155.14
Jun 15 08:04:39 server.1xxxhost.net kernel: Firewall: TCP_IN Blocked IN=eth0 OUT= MAC=00:16:3e:5d:bc:26:88:75:56:3c:e
Jun 15 08:04:45 server.1xxxhost.net kernel: Firewall: CC_DENY IN=eth0 OUT= MAC=00:16:3e:5d:bc:26:88:75:56:3c:e8:c0:08
Jun 15 08:04:49 server.1xxxhost.net kernel: Firewall: UDP_IN Blocked IN=eth0 OUT= MAC=00:16:3e:5d:bc:26:88:75:56:3c:e
Jun 15 08:04:53 server.1xxxhost.net kernel: Firewall: CC_DENY IN=eth0 OUT= MAC=00:16:3e:5d:bc:26:88:75:56:3c:e8:c0:08
lines 1619-1673/1673 (END)

without the firewall

[root@server ~]# journalctl -xe
Jun 15 14:40:06 server.1xxxhost.net sshd[7052]: pam_unix(sshd:auth): authentication failure; logname= uid=0 euid=0 tty=ssh ruser= rhost=192.9
Jun 15 14:40:08 server.1xxxhost.net sshd[7052]: Failed password for invalid user admin from 192.99.245.135 port 44964 ssh2
Jun 15 14:40:08 server.1xxxhost.net sshd[7052]: Received disconnect from 192.99.245.135 port 44964:11: Bye Bye [preauth]
Jun 15 14:40:08 server.1xxxhost.net sshd[7052]: Disconnected from 192.99.245.135 port 44964 [preauth]
Jun 15 14:40:19 server.1xxxhost.net sshd[7057]: Invalid user levendov from 164.132.192.5 port 60912
Jun 15 14:40:19 server.1xxxhost.net sshd[7057]: input_userauth_request: invalid user levendov [preauth]
Jun 15 14:40:19 server.1xxxhost.net sshd[7057]: pam_unix(sshd:auth): check pass; user unknown
Jun 15 14:40:19 server.1xxxhost.net sshd[7057]: pam_unix(sshd:auth): authentication failure; logname= uid=0 euid=0 tty=ssh ruser= rhost=164.1
Jun 15 14:40:22 server.1xxxhost.net sshd[7057]: Failed password for invalid user levendov from 164.132.192.5 port 60912 ssh2
Jun 15 14:40:22 server.1xxxhost.net sshd[7057]: Received disconnect from 164.132.192.5 port 60912:11: Bye Bye [preauth]
Jun 15 14:40:22 server.1xxxhost.net sshd[7057]: Disconnected from 164.132.192.5 port 60912 [preauth]
Jun 15 14:41:01 server.1xxxhost.net systemd[1]: Started Session 8602 of user root.
-- Subject: Unit session-8602.scope has finished start-up
-- Defined-By: systemd

-- Support: lists.freedesktop.org/mailman/list...

-- Unit session-8602.scope has finished starting up.

-- The start-up result is done.
Jun 15 14:41:01 server.1xxxhost.net CROND[7075]: (root) CMD (/etc/nginx/utilities/https_vhosts.sh >> /dev/null 2>&1)
Jun 15 14:41:09 server.1xxxhost.net sshd[7081]: Invalid user cbethenc from 82.196.15.195 port 52178
Jun 15 14:41:09 server.1xxxhost.net sshd[7081]: input_userauth_request: invalid user cbethenc [preauth]
Jun 15 14:41:09 server.1xxxhost.net sshd[7081]: pam_unix(sshd:auth): check pass; user unknown
Jun 15 14:41:09 server.1xxxhost.net sshd[7081]: pam_unix(sshd:auth): authentication failure; logname= uid=0 euid=0 tty=ssh ruser= rhost=82.19
Jun 15 14:41:12 server.1xxxhost.net sshd[7081]: Failed password for invalid user cbethenc from 82.196.15.195 port 52178 ssh2
Jun 15 14:41:12 server.1xxxhost.net sshd[7081]: Received disconnect from 82.196.15.195 port 52178:11: Bye Bye [preauth]
Jun 15 14:41:12 server.1xxxhost.net sshd[7081]: Disconnected from 82.196.15.195 port 52178 [preauth]
Jun 15 14:41:19 server.1xxxhost.net sshd[7086]: pam_unix(sshd:auth): authentication failure; logname= uid=0 euid=0 tty=ssh ruser= rhost=190.6
Jun 15 14:41:19 server.1xxxhost.net sshd[7086]: pam_succeed_if(sshd:auth): requirement "uid >= 1000" not met by user "root"
Jun 15 14:41:21 server.1xxxhost.net sshd[7086]: Failed password for root from 190.67.116.12 port 56396 ssh2
Jun 15 14:41:21 server.1xxxhost.net sshd[7086]: Received disconnect from 190.67.116.12 port 56396:11: Bye Bye [preauth]
Jun 15 14:41:21 server.1xxxhost.net sshd[7086]: Disconnected from 190.67.116.12 port 56396 [preauth]
Jun 15 14:41:23 server.1xxxhost.net sudo[7088]: root : TTY=pts/0 ; PWD=/root ; USER=root ; COMMAND=/bin/systemctl restart nginx
Jun 15 14:41:23 server.1xxxhost.net sudo[7088]: pam_unix(sudo:session): session opened for user root by root(uid=0)
Jun 15 14:41:23 server.1xxxhost.net polkitd[2391]: Registered Authentication Agent for unix-process:7089:23977290 (system bus name :1.17262 [
Jun 15 14:41:23 server.1xxxhost.net systemd[1]: Starting nginx - high performance web server...
-- Subject: Unit nginx.service has begun start-up
-- Defined-By: systemd

-- Support: lists.freedesktop.org/mailman/list...

-- Unit nginx.service has begun starting up.
Jun 15 14:41:23 server.1xxxhost.net nginx[7095]: nginx: [emerg] unknown directive "includon" in /etc/nginx/nginx.conf:123
Jun 15 14:41:23 server.1xxxhost.net systemd[1]: nginx.service: control process exited, code=exited status=1
Jun 15 14:41:23 server.1xxxhost.net systemd[1]: Failed to start nginx - high performance web server.
-- Subject: Unit nginx.service has failed
-- Defined-By: systemd

-- Support: lists.freedesktop.org/mailman/list...

-- Unit nginx.service has failed.

-- The result is failed.
Jun 15 14:41:23 server.1xxxhost.net systemd[1]: Unit nginx.service entered failed state.
Jun 15 14:41:23 server.1xxxhost.net systemd[1]: nginx.service failed.
Jun 15 14:41:23 server.1xxxhost.net polkitd[2391]: Unregistered Authentication Agent for unix-process:7089:23977290 (system bus name :1.17262
Jun 15 14:41:23 server.1xxxhost.net sudo[7088]: pam_unix(sudo:session): session closed for user root
lines 1591-1645/1645 (END)