Reputation: 97
I'm trying get up a server to do straming by webcam, I'm a relatively new user from Ubuntu and install Nginx, now, I'm try to modify the nginx.conf and configurate the rtmp server and this is my script file
user www-data;
worker_processes 4;
pid /run/nginx.pid;
events {
worker_connections 768;
# multi_accept on;
}
http {
##
# Basic Settings
##
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 65;
types_hash_max_size 2048;
# server_tokens off;
# server_names_hash_bucket_size 64;
# server_name_in_redirect off;
include /etc/nginx/mime.types;
default_type application/octet-stream;
##
# Logging Settings
##
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;
##
# Gzip Settings
##
gzip on;
gzip_disable "msie6";
# gzip_vary on;
# gzip_proxied any;
# gzip_comp_level 6;
# gzip_buffers 16 8k;
# gzip_http_version 1.1;
# gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript;
##
# nginx-naxsi config
##
# Uncomment it if you installed nginx-naxsi
##
#include /etc/nginx/naxsi_core.rules;
##
# nginx-passenger config
##
# Uncomment it if you installed nginx-passenger
##
#passenger_root /usr;
#passenger_ruby /usr/bin/ruby;
##
# Virtual Host Configs
##
include /etc/nginx/conf.d/*.conf;
include /etc/nginx/sites-enabled/*;
}
rtmp {
server {
listen 1935;
chunk_size 8192;
application vod {
play /home/juanbg/vod ;
}
application live {
live on;
record off;
}
}
}
To modified this, I used sublime text 3 for ubuntu, I saved the file, and when I try run nginx in the terminal this happen:
juanbg@JuanBG:~$ sudo nginx
nginx: [emerg] unknown directive "rtmp" in /etc/nginx/nginx.conf:76
I read all similiar situations in this website and in others, and all is issue because the rtmp is inside brackets of http (http{rtmp{}}) but in this case not, (or not that I know).
Upvotes: 6
Views: 37078
Reputation: 11
Hey try to link the modules-available to modules-enabled
ln -s /usr/share/nginx/modules-available/mod-rtmp.conf /etc/nginx/modules-enabled/50-mod-rtmp.conf
Worked for me.
Also check the link where I found the solution.
https://www.reddit.com/r/debian/comments/uo0nd5/comment/i8bkspi/
Upvotes: 1
Reputation: 51
On Ubuntu, you just need install the rtmp module.
sudo apt-get update
sudo apt-get install libnginx-mod-rtmp
sudo service nginx restart
Upvotes: 3
Reputation: 180
There was a similar problem (albeit on another OS): "nginx: [emerg] unknown directive "rtmp" in /usr/local/etc/nginx/rtmp-enabled/test.conf:2"
# uname -ro
FreeBSD 11.1-RELEASE-p1
# nginx -V
nginx version: nginx/1.14.0
built with OpenSSL 1.0.2k-freebsd 26 Jan 2017
TLS SNI support enabled
configure arguments: --prefix=/usr/local/etc/nginx --with-cc-opt='-I /usr/local/include' --with-ld-opt='-L /usr/local/lib' --conf-path=/usr/local/etc/nginx/nginx.conf --sbin-path=/usr/local/sbin/nginx --pid-path=/var/run/nginx.pid --error-log-path=/var/log/nginx/error.log --user=www --group=www --modules-path=/usr/local/libexec/nginx --with-file-aio --with-threads --without-mail_imap_module --without-mail_pop3_module --without-mail_smtp_module --with-mail_ssl_module --http-client-body-temp-path=/var/tmp/nginx/client_body_temp --http-fastcgi-temp-path=/var/tmp/nginx/fastcgi_temp --http-proxy-temp-path=/var/tmp/nginx/proxy_temp --http-scgi-temp-path=/var/tmp/nginx/scgi_temp --http-uwsgi-temp-path=/var/tmp/nginx/uwsgi_temp --http-log-path=/var/log/nginx/access.log --with-http_addition_module --with-http_auth_request_module --with-http_dav_module --with-http_flv_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_mp4_module --with-http_random_index_module --with-http_realip_module --with-pcre --with-http_secure_link_module --with-http_slice_module --with-http_ssl_module --with-http_stub_status_module --with-http_sub_module --with-http_v2_module --with-stream_ssl_module --with-mail=dynamic --with-stream=dynamic --add-dynamic-module=/usr/ports/www/nginx/work/nginx-rtmp-module-1.2.1
It's work for me:
After make (make install clean), edit config (/usr/local/etc/nginx/nginx.conf) and add line:
load_module /usr/local/libexec/nginx/ngx_rtmp_module.so;
For Linux, the path to the library will be different.
Upvotes: 1
Reputation: 563
I know this question is quite old but this might be helpfull for others.
When installing nginx for rtmp the program must be compiled from source. (e.g. as desecribed here)
In short:
sudo apt-get install build-essential libpcre3 libpcre3-dev libssl-dev
wget http://nginx.org/download/nginx-1.9.2.tar.gz
wget https://github.com/arut/nginx-rtmp-module/archive/master.zip
unzip master.zip
tar -zxvf nginx-1.9.2.tar.gz
In case you want to use the lastest version from http://nginx.org/download/, then change the version number appropriate.
cd nginx-1.9.2
./configure --with-http_ssl_module --add-module=../nginx-rtmp-module-master
make
sudo make install
Now the nginx.conf must be changed.
Make sure to start the right binary, check it with which nginx
on the command line. This should point to /usr/local/nginx/sbin/nginx
, otherwise the rtmp-module is unknown.
start: nginx
stop: nginx -s stop
Upvotes: 10
Reputation: 1461
Install nginx via homebrew follwing http://brew.sh/homebrew-nginx/. Make sure to use the --with-rtmp-module
flag.
Also note that this installs to /usr/local/etc/nginx
Upvotes: 0