Skip to content

ClipBucketV5 installation guide

MacWarrior edited this page Dec 11, 2024 · 7 revisions

Easy installation script

Easy installation scripts are only made for local / dev environments setup, be aware of your system security if going live !

Available scripts

Easy installation scripts are available for :

How-to

These scripts are made to run on clean systems, and must be launched with root user

  • Download raw script, then run it, it's that easy

Manual installation

  • Install Apache2 or Nginx [Nginx recommended]
  • Install MySQL or MariaDB [MariaDB recommended]
  • Install FFMpeg, FFProbe & MediaInfo
  • Install PHP [At least 7.0, 8.3+ recommended ; PHP-FPM recommended]
  • Use git to clone repository : git clone https://github.com/MacWarrior/clipbucket-v5.git
  • Create your vhost pointing to /upload/ sub-directory
  • Open website and follow installation process

Nginx

When using Nginx, you have to specify Vhost rules ; here is our default vhost :

server {
    listen 80;
    server_name YOUR_DOMAIN_NAME;
    root YOUR_INSTALL_PATH;
    index index.php;

    client_max_body_size 2M;

    proxy_connect_timeout 7200s;
    proxy_send_timeout 7200s;
    proxy_read_timeout 7200s;
    fastcgi_send_timeout 7200s;
    fastcgi_read_timeout 7200s;

    fastcgi_buffers 16 32k;
    fastcgi_buffer_size 64k;
    fastcgi_busy_buffers_size 64k;
    proxy_buffer_size 128k;
    proxy_buffers 4 256k;
    proxy_busy_buffers_size 256k;

    # set expiration of assets to MAX for caching
    location ~* \.(ico|css|js)(\?[0-9]+)?$ {
        expires max;
        log_not_found off;
    }

    location ~ \.(git|github|idea|gitignore|htaccess) {
        return 302 /403;
    }

    location ~* \.php$ {
        fastcgi_pass unix:/var/run/php/YOUR_PHP_SOCKET_PATH.sock;
        fastcgi_index index.php;
        fastcgi_split_path_info ^(.+\.php)(.*)$;
        include fastcgi_params;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    }

    location / {
        if ($query_string ~ "mosConfig_[a-zA-Z_]{1,21}(=|\%3D)"){
            rewrite ^/([^.]*)/?$ /index.php last;
        }
        rewrite ^/(.*)_v([0-9]+) /watch_video.php?v=$2&$query_string last;
        rewrite ^/([a-zA-Z0-9-]+)/?$ /view_channel.php?uid=$1&seo_diret=yes last;
    }

    error_page 404 /404;
    error_page 403 /403;
    location /403 {
        try_files $uri /403.php;
    }
    location /404 {
        try_files $uri /404.php;
    }

    location /includes/ {
        return 302 /404;
    }

    location /changelog/ {
        return 302 /404;
    }

    location /video/ {
        rewrite ^/video/(.*)/(.*) /watch_video.php?v=$1&$query_string last;
        rewrite ^/video/([0-9]+)_(.*) /watch_video.php?v=$1&$query_string last;
    }

    location /videos/ {
        rewrite ^/videos/(.*)/(.*)/(.*)/(.*)/(.*) /videos.php?cat=$1&sort=$3&time=$4&page=$5&seo_cat_name=$2 last;
        rewrite ^/videos/([0-9]+) /videos.php?page=$1 last;
        rewrite ^/videos/?$ /videos.php?$query_string last;
    }

    location /channels/ {
        rewrite ^/channels/(.*)/(.*)/(.*)/(.*)/(.*) /channels.php?cat=$1&sort=$3&time=$4&page=$5&seo_cat_name=$2 last;
        rewrite ^/channels/([0-9]+) /channels.php?page=$1 last;
        rewrite ^/channels/?$ /channels.php last;
    }

    location /members/ {
        rewrite ^/members/?$ /channels.php last;
    }

    location /users/ {
        rewrite ^/users/?$ /channels.php last;
    }

    location /user/ {
        rewrite ^/user/(.*) /view_channel.php?user=$1 last;
    }

    location /channel/ {
        rewrite ^/channel/(.*) /view_channel.php?user=$1 last;
    }

    location /my_account {
        rewrite ^/my_account /myaccount.php last;
    }

    location /page/ {
        rewrite ^/page/([0-9]+)/(.*) /view_page.php?pid=$1 last;
    }

    location /search/ {
        rewrite ^/search/result/?$ /search_result.php last;
    }

    location /upload {
        rewrite ^/upload/?$ /upload.php last;
    }

    location /contact/ {
        rewrite ^/contact/?$ /contact.php last;
    }

    location /categories/ {
        rewrite ^/categories/?$ /categories.php last;
    }

    location /collections/ {
        rewrite ^/collections/(.*)/(.*)/(.*)/(.*)/(.*) /collections.php?cat=$1&sort=$3&time=$4&page=$5&seo_cat_name=$2 last;
        rewrite ^/collections/([0-9]+) /collections.php?page=$1 last;
        rewrite ^/collections/?$ /collections.php last;
    }

    location /photos/ {
        rewrite ^/photos/(.*)/(.*)/(.*)/(.*)/(.*) /photos.php?cat=$1&sort=$3&time=$4&page=$5&seo_cat_name=$2 last;
        rewrite ^/photos/([0-9]+) /photos.php?page=$1 last;
        rewrite ^/photos/?$ /photos.php last;
    }

    location /collection/ {
        rewrite ^/collection/(.*)/(.*)/(.*) /view_collection.php?cid=$1&type=$2&page=$3 last;
    }

    location /item/ {
        rewrite ^/item/(.*)/(.*)/(.*)/(.*) /view_item.php?item=$3&type=$1&collection=$2 last;
    }

    location /photo_upload {
        rewrite ^/photo_upload/(.*) /photo_upload.php?collection=$1 last;
        rewrite ^/photo_upload/?$ /photo_upload.php last;
    }

    location = /sitemap.xml {
        rewrite ^(.*)$ /sitemap.php last;
    }

    location /signup {
        rewrite ^/signup/?$ /signup.php last;
    }

    location /rss/ {
        rewrite ^/rss/([a-zA-Z0-9].+)$ /rss.php?mode=$1&$query_string last;
    }

    location /list/ {
        rewrite ^/list/([0-9]+)/(.*)?$ /view_playlist.php?list_id=$1 last;
    }

    location ~ /rss$ {
        try_files $uri /rss.php;
    }
}