sudo apt-get update
sudo apt-get -y dist-upgrade
sudo apt-get clean

--安裝nodejs--
sudo apt-get install curl
curl -sL https://deb.nodesource.com/setup_6.x | sudo -E bash -
sudo apt-get install -y nodejs

--装种子生成--
npm install -g create-torrent
create-torrent --urlList "https://website.com/media/dome.mp4" dome.mp4 -o dome.torrent
create-torrent說明 https://website.com/media/dome.mp4 要获取的视频网址路径
dome.mp4所在目录mp4 dome.torrent生成的种子文件
--添加域名--
sudo apt-get install nginx
sudo cp /etc/nginx/sites-available/default /etc/nginx/sites-available/website.com
sudo vim /etc/nginx/sites-available/website.com

server {
        listen 80 ;
        listen [::]:80 ;

        root /home/file;
        index index.html index.htm index.nginx-debian.html;

        server_name _;

        location / {
                try_files $uri $uri/ =404;
        }
}

--启用服务器块冲洗启动Nginx--

sudo ln -s /etc/nginx/sites-available/website.com /etc/nginx/sites-enabled/
sudo nginx -t
sudo systemctl restart nginx

--必须使用ssl证书获取免费证书--

https://certbot.eff.org/

--CORS跨域请求配置--

location / {
if ($request_method = 'OPTIONS') {  
    add_header 'Access-Control-Allow-Origin' '*';  
    add_header 'Access-Control-Allow-Credentials' 'true';  
    add_header 'Access-Control-Allow-Methods' 'GET, POST, PUT, DELETE, PATCH, OPTIONS';  
    add_header 'Access-Control-Allow-Headers' 'Referer,Accept-Encoding,Range,Authorization,Content-Type,Accept,Origin,User-Agent,DNT,Cache-Control,X-Mx-ReqToken,Keep-Alive,X-Requested-With,If-Modified-Since';  
    return 204;
}
if ($request_method = 'POST') {  
    add_header 'Access-Control-Allow-Origin' '*';  
    add_header 'Access-Control-Allow-Credentials' 'true';  
    add_header 'Access-Control-Allow-Methods' 'GET, POST, PUT, DELETE, PATCH, OPTIONS';  
    add_header 'Access-Control-Allow-Headers' 'Referer,Accept-Encoding,Range,Authorization,Content-Type,Accept,Origin,User-Agent,DNT,Cache-Control,X-Mx-ReqToken,Keep-Alive,X-Requested-With,If-Modified-Since';  
}  
if ($request_method = 'GET') {  
    add_header 'Access-Control-Allow-Origin' '*';  
    add_header 'Access-Control-Allow-Credentials' 'true';  
    add_header 'Access-Control-Allow-Methods' 'GET, POST, PUT, DELETE, PATCH, OPTIONS';  
    add_header 'Access-Control-Allow-Headers' 'Referer,Accept-Encoding,Range,Authorization,Content-Type,Accept,Origin,User-Agent,DNT,Cache-Control,X-Mx-ReqToken,Keep-Alive,X-Requested-With,If-Modified-Since';  
}
}