Như tiêu đề lên không dài thì mình share source code cho ae tự dùng, code này cũng hỗ trợ cho ae Upload lên google driver, R2 hoặc upload trực tiếp trên server.
Để tránh tình trạng Cloudflare block acc do .ts lên mình đã tùy biến thay đổi mọi thứ cho ae bypass cloudflare cho ae chơi.
Ae tự clone về .env.example về thành .env nhé trong đó có sẵn file Dockerfile rồi chỉ việc deploy thành container muốn bê đi đâu cũng dễ, cái này chỉ là backend ae muốn hoàn chỉnh thì tự viết thêm frontend nhé. Muốn biết API cứ vào phần routes/web.php.
Còn ae muốn test trên môi trường dev thì nhớ chạy composer install . Còn không đẩy thẳng lên docker cho nhàn nhé, nhớ phải thêm nginx vào.
Loại code: Lumen framework (PHP)
# Mình sẽ để 0.333 MR ae tự dùng mà đổi để download chắc tính ra được mấy ngàn vnđ thôi, kêu nữa thì chịu =)).
conf nginx
Để tránh tình trạng Cloudflare block acc do .ts lên mình đã tùy biến thay đổi mọi thứ cho ae bypass cloudflare cho ae chơi.
Ae tự clone về .env.example về thành .env nhé trong đó có sẵn file Dockerfile rồi chỉ việc deploy thành container muốn bê đi đâu cũng dễ, cái này chỉ là backend ae muốn hoàn chỉnh thì tự viết thêm frontend nhé. Muốn biết API cứ vào phần routes/web.php.
Còn ae muốn test trên môi trường dev thì nhớ chạy composer install . Còn không đẩy thẳng lên docker cho nhàn nhé, nhớ phải thêm nginx vào.
Loại code: Lumen framework (PHP)
# Mình sẽ để 0.333 MR ae tự dùng mà đổi để download chắc tính ra được mấy ngàn vnđ thôi, kêu nữa thì chịu =)).
conf nginx
Code:
server {
listen 80;
server_name localhost;
root /var/www/html/public;
index index.php index.html;
client_max_body_size 500M;
location / {
try_files $uri $uri/ /index.php?$query_string;
}
# Serve HLS files
location /hls/ {
alias /var/www/html/storage/app/public/hls/;
# CORS headers for HLS streaming
add_header Access-Control-Allow-Origin *;
add_header Access-Control-Allow-Methods 'GET, OPTIONS';
add_header Access-Control-Allow-Headers 'Range, Content-Type';
# Cache HLS segments
expires 1h;
add_header Cache-Control "public, immutable";
# Handle m3u8 playlist files
location ~ \.m3u8$ {
add_header Content-Type application/vnd.apple.mpegurl;
expires -1;
}
# Handle ts segment files
location ~ \.ts$ {
add_header Content-Type video/mp2t;
}
}
location ~ \.php$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
fastcgi_read_timeout 600;
}
location ~ /\.ht {
deny all;
}
}
