mirror of
https://gitee.com/pan648540858/wvp-GB28181-pro.git
synced 2026-05-06 06:06:08 +08:00
docker里的录像也能正常看了
This commit is contained in:
parent
f0f62fa675
commit
752ee1c290
@ -68,7 +68,7 @@ services:
|
||||
- "${MediaRtp:-10000}:${MediaRtp:-10000}/tcp" # [收流]RTP
|
||||
- "${MediaRtp:-10000}:${MediaRtp:-10000}/udp" # [收流]RTP
|
||||
volumes:
|
||||
- ./volumes/video:/opt/media/www/record/
|
||||
- ./volumes/video:/opt/media/bin/www/record/
|
||||
- ./logs/media:/opt/media/log/
|
||||
- ./media/config.ini:/conf/config.ini
|
||||
command: [
|
||||
@ -140,8 +140,11 @@ services:
|
||||
depends_on:
|
||||
- polaris-wvp
|
||||
volumes:
|
||||
- ./nginx/conf/nginx.conf:/etc/nginx/nginx.conf
|
||||
- ./nginx/templates/:/etc/nginx/templates
|
||||
- ./logs/nginx:/var/log/nginx
|
||||
environment:
|
||||
# 流链接的IP
|
||||
Stream_IP: ${Stream_IP}
|
||||
networks:
|
||||
- media-net
|
||||
|
||||
|
||||
@ -111,7 +111,7 @@ hls_save_path=./www
|
||||
modify_stamp=2
|
||||
mp4_as_player=0
|
||||
mp4_max_second=3600
|
||||
mp4_save_path=/opt/media/www
|
||||
mp4_save_path=/opt/media/bin/www
|
||||
paced_sender_ms=0
|
||||
rtmp_demand=0
|
||||
rtsp_demand=0
|
||||
@ -151,7 +151,7 @@ directProxy=1
|
||||
enhanced=0
|
||||
handshakeSecond=15
|
||||
keepAliveSecond=15
|
||||
port=10935
|
||||
port=10001
|
||||
sslport=0
|
||||
|
||||
[rtp]
|
||||
@ -181,7 +181,7 @@ directProxy=1
|
||||
handshakeSecond=15
|
||||
keepAliveSecond=15
|
||||
lowLatency=0
|
||||
port=5540
|
||||
port=10002
|
||||
rtpTransportType=-1
|
||||
sslport=0
|
||||
|
||||
|
||||
@ -1,78 +0,0 @@
|
||||
#user nobody;
|
||||
worker_processes 1;
|
||||
|
||||
#error_log logs/error.log;
|
||||
#error_log logs/error.log notice;
|
||||
#error_log logs/error.log info;
|
||||
|
||||
#pid logs/nginx.pid;
|
||||
|
||||
|
||||
events {
|
||||
worker_connections 1024;
|
||||
}
|
||||
|
||||
|
||||
http {
|
||||
include mime.types;
|
||||
default_type application/octet-stream;
|
||||
|
||||
sendfile on;
|
||||
#tcp_nopush on;
|
||||
|
||||
#keepalive_timeout 0;
|
||||
keepalive_timeout 65;
|
||||
|
||||
#gzip on;
|
||||
|
||||
server {
|
||||
listen 8080;
|
||||
server_name localhost;
|
||||
|
||||
location / {
|
||||
root /opt/dist;
|
||||
index index.html index.htm;
|
||||
}
|
||||
location /record_proxy/{
|
||||
proxy_set_header Host $http_host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header REMOTE-HOST $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_pass http://polaris-wvp:18978/;
|
||||
}
|
||||
location /api/ {
|
||||
proxy_set_header Host $http_host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header REMOTE-HOST $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_pass http://polaris-wvp:18978;
|
||||
}
|
||||
|
||||
# 仅允许代理/rtp/开头的路径
|
||||
location ^~ /rtp/ {
|
||||
# 代理到ZLMediakit服务
|
||||
proxy_pass http://polaris-media:80;
|
||||
|
||||
# 基础HTTP代理配置
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
|
||||
# WebSocket支持配置
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Connection "upgrade";
|
||||
|
||||
# 超时设置,根据实际需求调整
|
||||
proxy_connect_timeout 60s;
|
||||
proxy_read_timeout 3600s;
|
||||
proxy_send_timeout 60s;
|
||||
}
|
||||
|
||||
error_page 500 502 503 504 /50x.html;
|
||||
location = /50x.html {
|
||||
root html;
|
||||
}
|
||||
}
|
||||
}
|
||||
110
docker/nginx/templates/nginx.conf.template
Normal file
110
docker/nginx/templates/nginx.conf.template
Normal file
@ -0,0 +1,110 @@
|
||||
server {
|
||||
listen 8080;
|
||||
server_name localhost;
|
||||
|
||||
location / {
|
||||
root /opt/dist;
|
||||
index index.html index.htm;
|
||||
}
|
||||
location /record_proxy/{
|
||||
proxy_set_header Host $http_host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header REMOTE-HOST $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_pass http://polaris-wvp:18978/;
|
||||
}
|
||||
location /api/ {
|
||||
proxy_set_header Host $http_host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header REMOTE-HOST $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_pass http://polaris-wvp:18978;
|
||||
|
||||
|
||||
# 从环境变量获取原始主机地址(x.x.x.x)
|
||||
set $original_host ${Stream_IP};
|
||||
|
||||
# 执行字符串替换
|
||||
# 将媒体资源文件替换为Nginx输出的相对地址
|
||||
sub_filter "http://$original_host/index/api/downloadFile" "mediaserver/api/downloadFile";
|
||||
sub_filter "http://$original_host:80/index/api/downloadFile" "mediaserver/api/downloadFile";
|
||||
sub_filter "https://$original_host/index/api/downloadFile" "mediaserver/api/downloadFile";
|
||||
sub_filter "https://$original_host:443/index/api/downloadFile" "mediaserver/api/downloadFile";
|
||||
sub_filter "http://$original_host/mp4_record" "mp4_record";
|
||||
sub_filter "http://$original_host:80/mp4_record" "mp4_record";
|
||||
sub_filter "https://$original_host/mp4_record" "mp4_record";
|
||||
sub_filter "https://$original_host:443/mp4_record" "mp4_record";
|
||||
|
||||
# 设置为off表示替换所有匹配项,而不仅仅是第一个
|
||||
sub_filter_once off;
|
||||
|
||||
# 确保响应被正确处理
|
||||
sub_filter_types application/json; # 只对JSON响应进行处理
|
||||
}
|
||||
|
||||
# 将mediaserver/record转发到目标地址
|
||||
location /mediaserver/api/downloadFile {
|
||||
# 目标服务器地址
|
||||
proxy_pass http://polaris-media:80/index/api/downloadFile;
|
||||
|
||||
# 以下是常用的反向代理设置
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
|
||||
# 超时设置,根据需要调整
|
||||
proxy_connect_timeout 300s;
|
||||
proxy_send_timeout 300s;
|
||||
proxy_read_timeout 300s;
|
||||
}
|
||||
|
||||
# 仅允许代理/rtp/开头的路径
|
||||
location ^~ /rtp/ {
|
||||
# 代理到ZLMediakit服务
|
||||
proxy_pass http://polaris-media:80;
|
||||
|
||||
# 基础HTTP代理配置
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
|
||||
# WebSocket支持配置
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Connection "upgrade";
|
||||
|
||||
# 超时设置,根据实际需求调整
|
||||
proxy_connect_timeout 60s;
|
||||
proxy_read_timeout 3600s;
|
||||
proxy_send_timeout 60s;
|
||||
}
|
||||
|
||||
# 仅允许代理/rtp/开头的路径
|
||||
location ^~ /mp4_record/ {
|
||||
# 代理到ZLMediakit服务
|
||||
proxy_pass http://polaris-media:80;
|
||||
|
||||
# 基础HTTP代理配置
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
|
||||
# WebSocket支持配置
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Connection "upgrade";
|
||||
|
||||
# 超时设置,根据实际需求调整
|
||||
proxy_connect_timeout 60s;
|
||||
proxy_read_timeout 3600s;
|
||||
proxy_send_timeout 60s;
|
||||
}
|
||||
|
||||
error_page 500 502 503 504 /50x.html;
|
||||
location = /50x.html {
|
||||
root html;
|
||||
}
|
||||
}
|
||||
@ -113,7 +113,7 @@ media:
|
||||
# [可选]
|
||||
send-port-range: 50502,50506
|
||||
|
||||
record-path: /opt/media/www/record/
|
||||
record-path: /opt/media/bin/www/record/
|
||||
record-day: 7
|
||||
record-assist-port: 0
|
||||
user-settings:
|
||||
|
||||
Loading…
Reference in New Issue
Block a user