- synopsis
- What is nginx-http-flv-module?
- workflows
- caveat
-
step by step
- To see what version of nginx is currently installed
- Download the source code for the corresponding version of nginx
- Download nginx-http-flv-module module source code
- Recompile nginx
- Verify that nginx-http-flv-module is installed!
- references
synopsis
Modules in nginx are plugin-like concepts, but it is not possible to install extensions as easily as VsCode.
nginx to install other modules must get both the nginx source code and the module source code, and then manually compile it, hit the module into nginx, and ultimately generate an executable file named nginx.
What is nginx-http-flv-module?
nginx-http-flv-module is a module (expansion plugin) for nginx, which is based on the secondary development of nginx-rtmp-module and has all the features of nginx-rtmp-module. HTTP-FLV playback, GOP caching, virtual hosting, RTMP/HTTP-FLV pure audio support, HLS playback and more! Compatibility: Requires nginx version greater than or equal to 1.2.6.
workflows
Check the current version of nginx (assuming it is installed at /usr/local/nginx). Download the source code of the current version of nginx Download nginx-http-flv-module module source code Recompile nginx and append nginx-http-flv-module. Copy the newly compiled nginx executable to the current nginx installation directory (/usr/local/nginx/sbin)
caveat
Since nginx-http-flv-module includes the nginx-rtmp-module module, it is not possible to compile both nginx-http-flv-module and nginx-rtmp-module at the same time, and after we compile nginx-http-flv-module, we will already nginx-rtmp-module is fully functional.
step by step
To see what version of nginx is currently installed
[root@bogon sbin]# ./nginx -V
nginx version: nginx/1.18.0
built by gcc 4.8.5 20150623 (Red Hat 4.8.5-44) (GCC)
built with OpenSSL 1.0.2k-fips 26 Jan 2017
TLS SNI support enabled
configure arguments: --prefix=/usr/local/nginx --with-http_dav_module --with-http_stub_status_module --with-http_addition_module --with-http_sub_module --with-http_flv_module --with-http_mp4_module --with-pcre --with-http_ssl_module --with-http_gzip_static_module
V: small v only prints the version number, large v prints both the version number and extension information, here to use large v The purpose of getting the version number is to download the source code for that version later on Be careful to save what comes after arguments in the printout, as it will be used later in the compilation.
Download the source code for the corresponding version of nginx
Find a directory, let's say /home/cml.
Download nginx version 1.18.0
wget /download/nginx-1.18.
tar -zxvf nginx-1.18.
Download nginx-http-flv-module module source code
Go to /home/cml and download the source code for the nginx-http-flv-module module.
git clone /winshining/
Here you need to pay attention to the name of the directory where the source code is located and the hierarchy of the directory. Make sure there is a directory named nginx-http-flv-module in the /home/cml directory, and the contents of the directory are as follows:
[root@bogon nginx-http-flv-module]# tree -L 1
.
├── AUTHORS
├── config
├── dash
├── doc
├── hls
├── LICENSE
├── ngx_http_flv_live_module.c
├── ngx_http_flv_live_module.h
......
Recompile nginx
At this point, there are two directories under the /home/cml directory
nginx-1.18.0 nginx-http-flv-module
Go to the nginx-1.18.0 directory, you can see that there is a configure executable file, execute the following commands
./configure --prefix=/usr/local/nginx --with-http_dav_module --with-http_stub_status_module --with-http_addition_module --with-http_sub_module --with-http_flv_module --with-http_mp4_module --with-pcre --with-http_ssl_module --with-http_gzip_static_module --add-module=/home/cml/nginx-http-flv-module
Use configure to configure the compilation environment Use the "content after arguments" saved above as the first argument to configure. The second argument is --add-module=/home/cml/nginx-http-flv-module, which adds a module whose source code is located at /home/cml/nginx-http-flv-module.
If there are no errors, execute the compile command
make
After successful compilation, there will be an executable file named nginx in /home/cml/nginx-1.18.0/objs, this is the compiled nginx, which contains the installed functions and the newly added nginx-rtmp-module. /usr/local/nginx/sbin).
Note that you need to stop nginx before copying, otherwise it will report that the current file is busy and cannot be overwritten.
Verify that nginx-http-flv-module is installed!
nginx -V
If the printed message contains nginx-http-flv-module, it is installed.
quote
/winshining/nginx-http-flv-module/blob/master/
This article usesmdnice typographical