Answer the question
In order to leave comments, you need to log in
How to stream MP4 with reverse proxy?
Greetings.
I'm trying to raise a small video hosting. The initial data is as follows:
1. Backend server. Ubuntu 16 Server hosts application + content.
Django + UWSGI +
NGINX
user www-data;
worker_processes auto;
pid /etc/nginx/logs/nginx.pid;
events {
worker_connections 1024;
multi_accept on;
}
http {
upstream django {
server 127.0.0.1:8000;
}
server {
listen 80;
server_name XXX.XXX.XXX.191;
charset utf-8;
gzip on;
gzip_static on;
gzip_comp_level 5;
gzip_min_length 1024;
add_header 'Access-Control-Allow-Origin' '*';
add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
add_header 'Access-Control-Allow-Headers' 'DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range';
add_header 'Access-Control-Expose-Headers' 'Content-Length,Content-Range';
if_modified_since off;
add_header Accept-Ranges bytes;
location /static/ {
root /home/tube;
}
#location ~ \.mp4$ {
# sendfile on;
# tcp_nopush on;
# sendfile_max_chunk 1m;
#mp4;
#mp4_buffer_size 2m;
#mp4_max_buffer_size 10m;
# }
location / {
uwsgi_pass django;
include uwsgi_params;
}
}
}
user www-data;
worker_processes auto;
pid /etc/nginx/logs/nginx.pid;
events {worker_connections 1024;}
http {
include mime.types;
default_type application/octet-stream;
server {
listen 80;
server_name XXX.XXX.XXX.92;
proxy_http_version 1.1;
proxy_pass_request_headers on;
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_set_header Upgrade $http_upgrade;
proxy_set_header Range $http_range;
proxy_set_header If-Range $http_if_range;
proxy_no_cache $http_range $http_if_range;
location / {
proxy_pass http://XXX.XXX.XXX.191/;
}
}
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question