Custom Livestream Platform For DJI Phantom 4 Pro+ - nginx

Edit : Here's my ufw status:
Status: active
To Action From
-- ------ ----
80 ALLOW Anywhere
1935 ALLOW Anywhere
80 (v6) ALLOW Anywhere (v6)
1935 (v6) ALLOW Anywhere (v6)
And App List:
Available applications:
CUPS
So, I tweaked with DJI Phantom 4 Pro+ and discovered that it support custom stream platform. My question is how to do it? I can already create NginX RTMP server but I still can't figure out how to make the Drone connect and stream to it. I already test my server using OBS to http://{IP}/live with key test and open it using VLC (on my phone) at rtmp://{IP}/live/test. Here's my nginx conf:
worker_processes 1;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
server {
listen 192.168.0.39:80;
server_name localhost;
location / {
root html;
index index.html index.htm;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}
}
rtmp {
server {
listen 192.168.0.39:1935;
chunk_size 4096;
application live {
live on;
record off;
}
}
}

It turns out I'm just stupid. To anyone who has the same issue, don't make the same mistake as I did. I enter rtmp://{IP}/live/drone/. It should be rtmp://{IP}/live/drone (notice the missing "/")

Related

Javascript and Css file is not loading while using proxy_pass of Nginx

I have an angular application (say admin app) running at port 4200 in my windows machine. My Nginx is running at port 8080. When request is coming at Nginx I am forwarding it to my angular application (admin app, port 4200) but in that case Js and Css files are not rendered for the admin app and showing 404 error for all css/js files.
My operating System is windows 10
Here is my configuration at nginx.conf file:
worker_processes 1;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
server {
listen 8080 ;
server_name localhost;
location /admin {
proxy_pass http://localhost:4200/;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}
}
here is the error picture

NGINX web server configuration

I've just downloaded NGINX for Windows and I'm struggeling a bit.
It's up and running with my index file showing at 127.0.0.1:8080, but I'm having problems with connection my web server to my domain.
From what I understand from the documentation I've read online, I had to change the DNS properties at my registrar like this (target-IP is my public IP):
Here is my nginx.conf file:
worker_processes 1;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
server {
listen 8080;
server_name erikbugge.no www.erikbugge.no;
location / {
root www;
index index.html index.htm;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root www;
}
}
}
I have also port-forwarded port 8080 to my local IP address in my router.
The problem now is that whenever I'm trying to access my webpage www.erikbugge.no it simply redirects me to my public IP address.
I'm pretty sure I'm doing something wrong, but I have no idea what it is.
Please be gentle, I'm new to this web server stuff.

Passing a custom IP address with Nginx proxy server

My apologies if the title isn't descriptive, I wasn't sure how to word this. I need to connect to a VPN, and need a specific IP address to do it. I was wanting to use Nginx configured as proxy server to do this. Here is my Nginx config file:
worker_processes 1;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
gzip on;
server {
listen 8080;
server_name name;
location / {
resolver 8.8.8.8;
proxy_pass http://$http_host$uri$is_args$args;
proxy_bind 10.0.0.13;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}
}
I had thought I could achieve what I wanted with proxy_bind, but whenever I try to connect to a website I am given an Nginx error page. I checked the error log, and I get an error saying it couldn't assign the address. I don't even know if that's actually what I want to do. Any suggestions? Thanks in advance.

Connecting OBS-STUDIO to Nginx server

I have installed and started the Nginx server on Ubuntu 14.04. My objective is to stream a video (live) using HLS (HTTP live streaming). I followed this tutorial https://www.vultr.com/docs/setup-nginx-on-ubuntu-to-stream-live-hls-video, and it recommends using OBS-STUDIO. However, I don't know how to stream from the OBS-STUDIO to the Nginx and then view the stream from other machines (e.g. with VLC).
Add a media source for OBS.
Configure the self-defined media server on OBS, add a URL as follows:
URL: rtmp://domain_name:1935/hlslive
stream name: test
Build Nginx with nginx-rtmp-module ,install, and then config nginx.conf
vim /usr/local/nginx/conf/nginx.conf
add or config the following module:
rtmp {
server {
listen 1935; #listen port
chunk_size 4096;
application hlslive { #rtmp push stream request path
live on;
hls on;
hls_path /usr/share/nginx/html/hlslive/test;
hls_fragment 3s;
hls_playlist_length 18s;
}
}
}
also config as a http server for hls m3u8 request:
http {
...
server {
listen 8080;
server_name localhost;
#charset koi8-r;
#access_log logs/host.access.log main;
location / {
root /usr/share/nginx/html;
index index.html index.htm;
}
#error_page 404 /404.html;
# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}
}
run nginx
nginx -c /usr/local/nginx/conf/nginx.conf
Click Begin Push Stream on OBS.
Input the following URL to view the live video.
http://domain_name:8080/hlslive/test/test.m3u8

nginx proxy - how to allow connection from a specific ip

I've installed nginx and set it up as a forward proxy (see attached nginx.conf)
The server became overloaded and it seems like someone else was using it.
is there a way to limit the nginx proxy to receive request only from specific ips?
Please explain how I should change the nginx.conf to do it for ip 123.456.123.345
worker_processes 1;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
gzip on;
server {
listen 8080;
location / {
resolver 8.8.8.8;
proxy_pass http://$http_host$uri$is_args$args;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}
}
Do it like this:
location / {
allow 123.456.123.345;
deny all;
resolver 8.8.8.8;
proxy_pass http://$http_host$uri$is_args$args;
}
From the docs:
The rules are checked in sequence until the first match is found.
So if IP equals 123.456.123.345, access will be allowed, otherwise - denied.
If you want to allow multiple IPs, you can specify them before deny all;:
allow 123.456.123.345;
allow 345.123.456.123;
deny all;
"location" directive should be inside a 'server' directive

Resources