36 Star 353 Fork 201

Kyle / MediaServerUI

 / 详情

wvp + ZLM + mediaSerUI,前端在Nginx如何配置代理

已完成
创建于  
2020-07-31 10:07

wvp + ZLM + mediaSerUI,前端在Nginx如何配置代理,如果我把前端访问映射到外网之后,我在外网打开页面,前端地址会直接去请求内网的地址导致无法正常使用,按理来讲用nginx配置代理可以解决,不知道需要如何去配置?谢谢

评论 (3)

法师 创建了任务
法师 关联仓库设置为KKKKK5G/MediaServerUI
展开全部操作日志

大致配置文件如下

upstream media-server {
  server 127.0.0.1:8082;
}

server {
  listen 80;
  server_name localhost;
  index index.htm index.html;
  
  location /index/api {
	proxy_pass http://media-server;
  }
  
  location / {
    root /home/ubuntu/program/MediaServerUI/dist;
  }
  location = /favicon.ico {
    root /var/www/html;
  }

  location /NginxStatus {
    stub_status on;
    access_log off;
    auth_basic "NginxStatus";
  }
}

新增live和rtp
live用于http-flv播放
rtp用于ws播放

upstream media-server {
  server 127.0.0.1:8082;
}

server {
  listen 80;
  server_name localhost;
  index index.htm index.html;
  
  location /index/api {
	proxy_pass http://media-server;
  }
  
  location /live {
	proxy_pass http://media-server;
  }
  
  location /rtp {
	proxy_pass http://media-server;
	proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection "upgrade";
  }
  
  location / {
    root /home/ubuntu/program/MediaServerUI/dist;
  }
  location = /favicon.ico {
    root /var/www/html;
  }

  location /NginxStatus {
    stub_status on;
    access_log off;
    auth_basic "NginxStatus";
  }
}

增加wvp后的配置如下

upstream media-server {
  server 127.0.0.1:8082;
}

upstream wvp-gb28181 {
  server 127.0.0.1:8081;
}

server {
  listen 80;
  server_name localhost;
  index index.htm index.html;

  location /index/api {
    proxy_pass http://media-server;
  }

  location /live {
    proxy_pass http://media-server;
  }

  location /rtp {
    proxy_pass http://media-server;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection "upgrade";
  }
  
  location /api{
     proxy_pass http://wvp-gb28181;
  }

  location / {
    root /home/ubuntu/program/MediaServerUI/dist;
  }
  location = /favicon.ico {
    root /var/www/html;
  }

  location /NginxStatus {
    stub_status on;
    access_log off;
    auth_basic "NginxStatus";
  }
}
Kyle 任务状态待办的 修改为已完成

登录 后才可以发表评论

状态
负责人
里程碑
Pull Requests
关联的 Pull Requests 被合并后可能会关闭此 issue
分支
开始日期   -   截止日期
-
置顶选项
优先级
参与者(2)
1545926 litongjava admin 1578954200 687526 mallocxw 1578930812
JavaScript
1
https://gitee.com/kkkkk5G/MediaServerUI.git
git@gitee.com:kkkkk5G/MediaServerUI.git
kkkkk5G
MediaServerUI
MediaServerUI

搜索帮助