利用闲置服务器搭建自己的视频网站
本教程只为技术测试和学习,请勿用于商业和非法用途。
1.下载程序
playtube国内早期有人改为了中文版,叫做柠檬视频。
2.找到对应PHP版本的设置,在“禁用函数”里面把shell_exec这个函数删掉.
3.上传到服务器宝塔面板
将sp.sql数据库导入
4.修改网站根目录下config.php里的数据库连接信息
5.网站伪静态规则:
location / {
if (!-e $request_filename){
rewrite ^/$ /index.php?link1=home;
}
if (!-e $request_filename){
rewrite ^/aj/([^/.]+)/?$ /ajax.php?type=$1&first=$2;
rewrite ^/aj/([^/.]+)/([^/.]+)/?$ /ajax.php?type=$1&first=$2;
rewrite ^/aj/([^/.]+)/([^/.]+)/([^/.]+)/?$ /ajax.php?type=$1&first=$2&second=$3;
}
rewrite ^/@([^\/]+)(\/|)$ /index.php?link1=timeline&id=$1;
if (!-e $request_filename){
rewrite ^/([^\/]+)(\/|)$ /index.php?link1=$1;
}}location /reset {
rewrite ^/reset-password/([^\/]+)(\/|)$ /index.php?link1=reset-password&code=$1;}location /confirm {
rewrite ^/confirm/(.*)/(.*)$ /index.php?link1=confirm&code=$1&email=$2;}location /api {
rewrite ^/api/v(([0-9])([.][0-9]+))(\/|)$ /api.php?v=$1;}location /admin {
rewrite ^/admin-cp$ /admincp.php;
rewrite ^/admin-cp/(.*)$ /admincp.php?page=$1;}location /admin-cdn/ {
alias /admin-panel/;}location /videos {
rewrite ^/videos/category/(.*)/rss(\/|)$ /index.php?link1=videos&page=category&id=$1&feed=rss;
rewrite ^/videos/category/(.*)$ /index.php?link1=videos&page=category&id=$1;
rewrite ^/videos/(.*)/rss(\/|)$ /index.php?link1=videos&page=$1&feed=rss;
rewrite ^/videos/(.*)$ /index.php?link1=videos&page=$1;}location /articles {
rewrite ^/articles(\/|)$ /index.php?link1=articles;
rewrite ^/articles/category/(\d+)(\/|)$ /index.php?link1=articles&category_id=$1;
rewrite ^/articles/read/(.*)(\/|)$ /index.php?link1=read&id=$1;}location /edit {
rewrite ^/edit-video/(.*)?$ /index.php?link1=edit-video&id=$1;}location /watch {
rewrite ^/watch/([^\/]+)(\/|)?$ /index.php?link1=watch&id=$1;
rewrite ^/watch/([^\/]+)/list/([^\/]+)(\/|)?$ /index.php?link1=watch&id=$1&list=$2;}location /embed {
rewrite ^/embed/(.*)?$ /index.php?link1=embed&id=$1;}location /resend {
rewrite ^/resend/(.*)/(.*)?$ /index.php?link1=resend&id=$1&u_id=$2;}location /redirect {
rewrite ^/redirect/(.*)?$ /index.php?link1=redirect&id=$1;}location /settings {
rewrite ^/settings/(.*)/(.*)$ /index.php?link1=settings&page=$1&user=$2;
rewrite ^/settings/(.*)$ /index.php?link1=settings&page=$1;}location /terms {
rewrite ^/terms/([^\/]+)(\/|)$ /index.php?link1=terms&type=$1;}location /go_pro {
rewrite ^/go_pro(\/|)$ /index.php?link1=go_pro;}location /ads {
rewrite ^/ads(\/|)$ /index.php?link1=ads;
rewrite ^/ads/create(\/|)$ /index.php?link1=create_ads;
rewrite ^/ads/edit/(\d+)(\/|)$ /index.php?link1=edit_ads&id=$1;}location /contact {
rewrite ^/contact-us(\/|)$ /index.php?link1=contact;}
6.为你的服务器安装FFMPEG,ubuntu可以直接用以下代码安装:
sudo apt update
sudo apt install ffmpeg
安装成功测试:
ffmpeg -version
要打印所有可用的FFmpeg的编码器和解码器,请输入:
ffmpeg -encoders
ffmpeg -decoders
7.视频分类名称请修改
/assets/langs/china.php
声明:本站所有文章,如无特殊说明或标注,均为本站原创发布。任何个人或组织,在未征得本站同意时,禁止复制、盗用、采集、发布本站内容到任何网站、书籍等各类媒体平台。如若本站内容侵犯了原著者的合法权益,可联系我们进行处理。