My os info:
uname -a
Linux vultr 5.10.0-13-amd64 #1 SMP Debian 5.10.106-1 (2022-03-17) x86_64 GNU/Linux
I have installed module libnginx-mod-rtmp
with command
apt install libnginx-mod-rtmp
You can see the output info:
Created symlink /etc/systemd/system/multi-user.target.wants/nginx.service → /lib/systemd/system/nginx.service.
Setting up libnginx-mod-http-xslt-filter (1.18.0-6.1) ...
Setting up libnginx-mod-http-geoip (1.18.0-6.1) ...
Setting up libnginx-mod-rtmp (1.18.0-6.1) ...
Setting up libnginx-mod-mail (1.18.0-6.1) ...
Setting up libnginx-mod-http-image-filter (1.18.0-6.1) ...
Setting up libnginx-mod-stream (1.18.0-6.1) ...
Setting up libnginx-mod-stream-geoip (1.18.0-6.1) ...
Setting up nginx-core (1.18.0-6.1) ...
Upgrading binary: nginx.
Processing triggers for man-db (2.9.4-2) ...
Processing triggers for ufw (0.36-7.1) ...
Now set rmtp in config file.
vim /etc/nginx/nginx.conf
rtmp {
server {
listen 1935;
chunk_size 4096;
allow publish 127.0.0.1;
deny publish all;
application live {
live on;
record off;
}
}
}
Restart nginx.
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.
systemctl status nginx
● nginx.service - A high performance web server and a reverse proxy server
Loaded: loaded (/lib/systemd/system/nginx.service; enabled; vendor preset: enabled)
Drop-In: /etc/systemd/system/nginx.service.d
└─override.conf
Active: failed (Result: exit-code) since Wed 2022-05-04 08:14:19 CST; 16s ago
Docs: man:nginx(8)
Process: 96329 ExecStartPre=/usr/sbin/nginx -t -q -g daemon on; master_process on; (code=exited, status=1/FAILURE)
CPU: 7ms
May 04 08:14:19 vultr systemd[1]: Starting A high performance web server and a reverse proxy server...
May 04 08:14:19 vultr nginx[96329]: nginx: [emerg] unknown directive "rtmp" in /etc/nginx/nginx.conf:85
May 04 08:14:19 vultr nginx[96329]: nginx: configuration file /etc/nginx/nginx.conf test failed
May 04 08:14:19 vultr systemd[1]: nginx.service: Control process exited, code=exited, status=1/FAILURE
May 04 08:14:19 vultr systemd[1]: nginx.service: Failed with result 'exit-code'.
May 04 08:14:19 vultr systemd[1]: Failed to start A high performance web server and a reverse proxy server.
nginx -V
nginx version: nginx/1.18.0
built with OpenSSL 1.1.1k 25 Mar 2021 (running with OpenSSL 1.1.1n 15 Mar 2022)
TLS SNI support enabled
configure arguments: --with-cc-opt='-g -O2 -ffile-prefix-map=/build/nginx-q9LD4J/nginx-1.18.0=.
-fstack-protector-strong -Wformat -Werror=format-security
-fPIC -Wdate-time -D_FORTIFY_SOURCE=2'
--with-ld-opt='-Wl,-z,relro -Wl,-z,now -fPIC'
--prefix=/usr/share/nginx
--conf-path=/etc/nginx/nginx.conf
--http-log-path=/var/log/nginx/access.log
--error-log-path=/var/log/nginx/error.log
--lock-path=/var/lock/nginx.lock --pid-path=/run/nginx.pid
--modules-path=/usr/lib/nginx/modules
--http-client-body-temp-path=/var/lib/nginx/body
--http-fastcgi-temp-path=/var/lib/nginx/fastcgi
--http-proxy-temp-path=/var/lib/nginx/proxy
--http-scgi-temp-path=/var/lib/nginx/scgi
--http-uwsgi-temp-path=/var/lib/nginx/uwsgi
--with-compat --with-debug --with-pcre-jit
--with-http_ssl_module --with-http_stub_status_module
--with-http_realip_module
--with-http_auth_request_module
--with-http_v2_module --with-http_dav_module
--with-http_slice_module --with-threads
--with-http_addition_module
--with-http_gunzip_module --with-http_gzip_static_module
--with-http_sub_module
How to solve the issue ?
Best Answer
At first I thought you have to build the nginx with the module included, but it appears that's not needed when doing it through apt install.
You probably have to load the module manually (check if the module exists in the modules directory):
And another directory I've seen mentioned: