Welcome! Log In Create A New Profile

Advanced

How to access the specific port from RTMP container by proxy_pass through nginx container?

Posted by siavashfazli 
I have a main-nginx container that all requests comes to that, by proxy_pass requests routed to target container.

Now we need to add a new service called RTMP server for streaming video. by this link:

https://github.com/TareqAlqutami/rtmp-hls-server

this is my docker-compose file:
```
version: "3.9"
services:
rtmp:
container_name: rtmp_server
image: alqutami/rtmp-hls
expose:
- "1935/tcp"
- "8080/tcp"
volumes:
- ./conf-rtmp/nginx.conf:/etc/nginx/nginx.conf:ro
networks:
- main-nginx-net
restart: unless-stopped
nginx:
container_name: main-nginx
image: tiangolo/nginx-rtmp
ports:
- "80:80/tcp"
volumes:
- ./conf-nginx/nginx.conf:/etc/nginx/nginx.conf:ro
networks:
- main-nginx-net
networks:
main-nginx-net:
external: true
```
After running this docker-compose I have a link like this :

rtmp://test.****.com:1935/live for stream what you want.

by proxy_pass we can route HTTP and HTTPS links, now I need to route the above link(starts with rtmp:// ) to main-nginx to access RTMP server.

this is my nginx.conf:
```
worker_processes auto;
rtmp_auto_push on;
events {}
http {
server {
server_name test.*******.com;
location /tv {
proxy_pass http://rtmp;
proxy_set_header Host test.*******.com;
}
}
}
```
This configuration routes the RTMP web player correctly.

Now I need to write a block to route RTMP link to port:1935 of RTMP-server.

How can i do this?
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 93
Record Number of Users: 6 on February 13, 2018
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready