Nginx插件
原创大约 1 分钟
Nginx插件
nginx-rtmp-module
直播流插件
# 插件源码 https://github.com/arut/nginx-rtmp-module.git
# 找一个路径执行
git clone https://github.com/arut/nginx-rtmp-module.git
# cd 到nginx源码安装目录
./configure --prefix=/root/nginx --add-module=/刚才克隆的路径绝对路径/nginx-rtmp-module
make
## nginx 的源码目录会多一个 objs文件夹 文件夹下会有nginx 可执行文件
## 替换到nginx安装目录配置监听
rtmp {
server {
listen 1935;
chunk_size 4096;
application live {
live on;
record off;
# 添加 HLS 支持
hls on;
hls_path /root/nginx/html/hls;
hls_fragment 1s; # 将 HLS 切片大小设置为 1 秒
hls_playlist_length 10s; # 将播放列表长度设置为 3 秒
hls_cleanup on;
}
}
}配置
server {
listen 8080;
server_name localhost;
location /hls {
types {
application/vnd.apple.mpegurl m3u8;
video/mp2t ts;
}
root /root/nginx/html;
add_header Cache-Control no-cache;
}
}ngx-fancyindex
# 插件源码 https://github.com/aperezdc/ngx-fancyindex
# 找一个路径执行
git clone https://github.com/aperezdc/ngx-fancyindex
# cd 到nginx源码安装目录
./configure --prefix=/root/nginx --add-module=/刚才克隆的路径绝对路径/ngx-fancyindex
make
## nginx 的源码目录会多一个 objs文件夹 文件夹下会有nginx 可执行文件
## 替换到nginx安装目录配置nginx.conf
location /mirror {
alias /root/mirror;
fancyindex on;
fancyindex_exact_size off;
fancyindex_localtime on;
# fancyindex_header "/mirror/custom_style/header.html";
# fancyindex_footer "/mirror/custom_style/footer.html";
fancyindex_header "/mirror/custom_style/Nginx-Fancyindex/header.html";
fancyindex_footer "/mirror/custom_style/Nginx-Fancyindex/footer.html";
fancyindex_ignore "custom_style";
autoindex on;
autoindex_exact_size off;
autoindex_localtime on;
charset utf-8;
}