Jump to content

Search the Community

Showing results for tags 'infrastructure'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • General Discussion
    • Announcements
    • Business Discussion
    • Business Services
    • Sell and Buy
  • Themes & templates
    • KVS default theme
    • KVS tablet theme
    • KVS paysite theme
    • KVS basic theme 1
    • KVS basic theme 2
    • KVS basic theme 3
  • Educational / support
    • Technical Support
    • FAQ
    • Educational Series

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


About Me

Found 14 results

  1. If you have multiple tube sites on KVS, you can make related videos from one site to be part of another site. For example to render them as the first 3 related videos, or the last 3, or even as a separate list. Configuring page to render related videos HTML code on source site First you need to create a new page on source site (which videos you will take off). Go to Website UI -> Add page and create a new page with the following data: Display name: Related videos for <target site> (e.g. Related videos for kvs-demo.com) External ID: related_videos_for_<target_site> (e.g. related_videos_for_kvs_demo) Cache lifetime: 86400 Template code: {{insert name="getBlock" block_id="list_videos" block_name="Related Videos"}} Save this page and open it for editing. You will notice Related Videos block added to its block list. Open this block editor. In Related Videos block editor scroll down to Search videos by text parameter group and enable var_search = q parameter. Also under List pagination group make sure that items_per_page parameter has the exact number of videos you want to pull. In Template code you should render video items with template code that is needed for target site (e.g. kvs-demo.com in this example). The easiest way is to go to target site admin panel, go to its Website UI -> Page components -> include_list_videos_block_common.tpl and copy-paste everything within its primary {{foreach}} iteration. Here is what we copied from default theme: {{foreach item="item" from=$data}} <div class="item {{if $item.is_private==1}}private{{elseif $item.is_private==2}}premium{{/if}}"> <a {{if $item.view_page_url!=''}}href="{{$item.view_page_url}}"{{/if}} title="{{$item.title}}"> <div class="img"> {{if $item.status_id==0 || $item.status_id==1}} <img class="thumb {{if $lang.enable_thumb_lazyload=='true'}}lazy-load{{/if}}" {{if $lang.enable_thumb_lazyload=='true'}}src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7" data-original{{else}}src{{/if}}="{{$item.screen_url}}/{{$lang.videos.thumb_size}}/{{$item.screen_main}}.jpg" {{if $lang.videos.thumb_size_webp}}data-webp="{{$item.screen_url}}/{{$lang.videos.thumb_size_webp}}/{{$item.screen_main}}.jpg"{{/if}} alt="{{$item.title}}" {{if $lang.enable_thumb_scrolling=='true'}}data-cnt="{{$item.screen_amount}}"{{/if}} {{if $item.is_private==0 && $item.formats[$lang.videos.preview_video_format_standard].file_path!=''}}data-preview="{{$config.project_url}}/get_file/{{$item.server_group_id}}/{{$item.formats[$lang.videos.preview_video_format_standard].file_path}}/"{{/if}} {{if $item.is_private==2 && $item.formats[$lang.videos.preview_video_format_premium].file_path!=''}}data-preview="{{$config.project_url}}/get_file/{{$item.server_group_id}}/{{$item.formats[$lang.videos.preview_video_format_premium].file_path}}/"{{/if}} width="{{$lang.videos.thumb_size|geomsize:'width'}}" height="{{$lang.videos.thumb_size|geomsize:'height'}}"/> {{/if}} {{if $item.is_private==1}} <span class="line-private"><span class="ico-private">{{$lang.videos.list_label_private}}</span></span> {{elseif $item.is_private==2}} <span class="line-premium"><span class="ico-premium">{{$lang.videos.list_label_premium}}</span></span> {{/if}} {{if $item.is_hd==1}}<span class="is-hd">HD</span>{{/if}} </div> <strong class="title"> {{if $lang.videos.truncate_title_to>0}} {{$item.title|truncate:$lang.videos.truncate_title_to:"...":true}} {{else}} {{$item.title}} {{/if}} </strong> <div class="wrap"> <div class="duration">{{$item.duration_array.text}}</div> {{assign var="object_rating" value="`$item.rating/5*100`"}} {{if $object_rating>100}}{{assign var="object_rating" value="100"}}{{/if}} <div class="rating {{if $object_rating>=50 || $object_rating==0}}positive{{else}}negative{{/if}}"> {{$object_rating|string_format:"%d"}}% </div> </div> <div class="wrap"> {{assign var="added_date" value=$item.post_date}} {{if $mode_favourites==1}} {{assign var="added_date" value=$item.added2fav_date}} {{elseif $mode_purchased==1}} {{assign var="added_date" value=$item.purchase_date}} {{/if}} <div class="added"><em>{{$added_date|date_format:$lang.global.date_format}}</em></div> <div class="views">{{$item.video_viewed|number_format:0:",":$lang.global.number_format_delimiter}}</div> </div> </a> </div> {{/foreach}} Finally make sure you also put 86400 cache lifetime in this block settings. After saving block editor you can now check how it works (make sure to replace https://domain.com/related_videos_for_kvs_demo with your domain and page ID): https://domain.com/related_videos_for_kvs_demo.php?q=Test video If your database has something similar to "Test video", it should render several videos. Pulling videos from target site Now when the page is ready, go to target site admin panel. Locate page or block where you want to render this list (typically in Website UI -> Pages -> View Video -> Related Videos block or View Video page itself) and open it for editing. In template code add this (make sure to replace https://domain.com/related_videos_for_kvs_demo with your domain and page ID): {{php}} $storage = $this->get_template_vars('storage'); if (function_exists('get_page') && $storage['video_view_video_view']['title']) { echo get_page("", "https://domain.com/related_videos_for_kvs_demo.php?q=" . urlencode($storage['video_view_video_view']['title']), "", "", 1, 0, 3, ""); } {{/php}} Now refresh any of the video pages on target site and make sure that related videos from source site are displayed correctly. If they are displayed with wrong styling, make sure that template code from the previous section suits target site CSS styles and taken from target site, not from source site.
  2. How do I recover or find my admin password that I lost? There is no password reset button if you are locked out of admin panel.
  3. KVS tube script has very simple and at the same time very powerful storage system, which provides the following benefits: Unlimited storage space - add new servers / HDDs any time you need. Support for traffic load balancing - can serve the same content from multiple servers at the same time. Reliable protection from hotlink and unauthorized access. Easy migration - admin panel can migrate content to another storage automatically. Storage system settings are located in Settings -> Storage servers section in admin panel. Storage system is used to store video formats and album files (images and ZIPs). NOTE: video screenshots are not stored in this storage system, they are stored locally with the main site. However there are some workarounds to move them to another server if needed, which is described in this article: How to move static files to CDN or another server in KVS NOTE: since videos support 4 content types, only 1 content type is using KVS storage system: video upload. Other content types (hotlink, embed, pseudo) do not have any video files that need to be stored on your servers. When adding videos into KVS you should make sure you do not mix between video upload and hotlink, because both can be added using video file URL, but the difference is that video upload will process and store the downloaded file in KVS storage system (with all its benefits), while hotlink will be using the specified URL directly. You can read more about video content types in this article: What video types are supported in KVS tube script and how they are different Though the concept is very simple and straightforward, many KVS users do not understand it and tend to use it in wrong way. Let us try to explain it in more details here. NOTE: Storage systems for videos and albums work exactly in the same way. So we will only describe videos. Storage groups and servers When videos or albums are uploaded into KVS, they are stored not on storage servers directly, but on storage groups instead. A group can contain multiple storage servers, which is needed when you want to load balance the same content between multiple servers. We will say this in another way: if a group has multiple servers, ALL CONTENT of this group is DUPLICATED on all its servers even if some servers are deactivated. Each video of the group is stored on every server of this group. The common mistake when trying to move content to another server is to add the new server into the same group and disable the old server. NOTE: disabling server in storage system doesn't mean that KVS won't copy content there. KVS will duplicate content between ALL servers added to the same group. Disabling a server means that KVS won't use this server when streaming videos to users, but it can be enabled back at any time and immediately it will start serving all the content stored on it. So in most cases you should have 1 group = 1 server there. You should only add multiple servers into the same group in these cases: You want to load balance streaming between 2 or more servers. You want to have a backup server with all your content. You want to manually move content from 1 server to another. But in this case after content migration you will need to delete old storage server and finally leave only 1 server in the group. Sample diagram Sample diagram shows all storage system concepts in 1 screen. Storage group 1 has 2 servers and you can see that both Video 1 and Video 2 are stored on both servers. Storage group 2 has only 1 server, which stores completely another set of videos: Video 3 and Video 4. Here is KVS configuration for this storage system: Adding more space to storage system In order to expand your storage system you should create a new server group which will host new videos. Then you should add a new storage server into this new server group. That's it! In most cases new content will be copied to your new server group and thus new server under it. However in Settings -> Content settings there is an option which configures default storage for videos (and same option for albums). By default this option is configured to autodetect group with the most free space. If you added a new server group with more free space but the new content is still being added to the old server group, most probably you have changed this option, so please check if it is set to autodetect: Traffic load balancing between storage servers Why would you need this in the era of CDN? Here are some common cases: CDN can be more expensive than 2 standalone servers in US and Europe. So you can save by adding 2 servers instead and use GEOIP load balancing between them. For CDN you usually pay for 90% traffic peak. You can reduce this payment by serving low-profile countries from standard server (use GEOIP load balancing) and thus reducing traffic usage of your CDN and reducing monthly payments. In order to use load balancing you will need to add 2 (or more) servers into 1 group. If your storage group already hosts some videos, you will need to sync content on the new server by using sync option for it (this option is available on servers list). After using sync option KVS will create a background task for this operation which may take some time. If no content is hosted by your group, you don't need anything else, just add 2 servers into 1 group and configure their load balancing if needed in group settings: Moving content to another storage server Add new server into the existing group and use sync option to copy all existing content to this server. Sync option will create background task and you have to wait for it to be completed. Then after you checked everything you can delete the old server from KVS and the group will have 1 new server. NOTE: When a new server is added to a group which already hosts some content, this new server will be disabled by default, so KVS won't show it to users and you will have as much time as needed to manually copy all the content. Your site will still continue serving content from the old server until you manually activate the new server. So basically here are the steps: Add new server into the existing server group. Sync new server with all the existing content. Wait for sync background task to be finished, it may take hours or days depending on how much content you have. Activate the new server, deactivate the old server. Verify that everything is working, your content is functional. Delete old server from server group.
  4. If you want to get rid of Apache and have your site working purely on Nginx, please consider these steps to migrate Apache-specific configurations into Nginx. NOTE: we do not support this officially. Apache + mod_rewrite will still be required for KVS and all functionality we add or change in KVS is always tested in Apache environment. We cannot guarantee these steps are everything you need to migrate to pure Nginx. Also we cannot guarantee that any future features will work in pure Nginx environment or will not require changes in Nginx configuration to make them working correctly. Nginx should set the following environmental variables which are typically set by Apache: REMOTE_ADDR SCRIPT_FILENAME SCRIPT_NAME REQUEST_METHOD QUERY_STRING REQUEST_URI DOCUMENT_ROOT These are typically set by default fastcgi configuration, but worth mentioning. You can find nginx rewrites in _INSTALL/nginx_config.txt file in your installation archive.
  5. The world is changing and being able to put ongoing changes into your running site is essential need of any successful project. KVS regularly adds new features and some of these features are not brought into themes, so you have to add them manually. However doing changes on a live site brings some risks to harm site operation. In this article we summarize the possible configuration scenarios for ongoing site development and their disadvantages. Working on production theme The most typical scenario and very good for small projects. However actively working with regular changes may bring some issues. Pros: No specific configuration or procedure needed. Changes are applied immediately. Cons: Harmful changes may result in project unavailability for some time until sorted out. Intensive template changes may result in regular cache reset, which could impose performance issue when modifying top-visited list-block templates. Difficult to work in development-testing iterations, when partial changes applied, then tested, then next set of changes applied, and etc. Security considerations (should provide access to 3rd-party developers). DEV satellite DEV satellite is very useful for the new theme development, when you need to spend a lot of time with either re-design, or a new design for your site theme. While working on DEV satellite you can't harm a working project in any way and you don't need to hurry. When your new theme version is ready, all what you need is to migrate it from satellite to production site. End of story. However using DEV satellite for ongoing minor theme changes is not that safe, as you could assume. The main reason is - when you migrate theme, you can't migrate something specific, you have to migrate everything, including templates, styles, configuration parameters, SEO, texts and even site advertising. Having that in mind, it becomes clear that it is not possible to selectively use DEV for testing 'some' changes - it is either ALL, or nothing. Here is a typical scenario that could happen from time to time: You decided to change something minor in advertising (e.g. replace some ad) and decided to change it directly on production. Then after some time your theme developer started working with a new feature on DEV satellite. After the feature is finished, you migrated theme from DEV to production. Oops, your first advertising change has been lost at this point and you may not even remember about it. Hence the conclusion is - you can use DEV satellite for ongoing theme development only if you stick to strict process of putting all changes into DEV first, then testing them on DEV and then migrating them to production. If you decide to go with this approach, it will be possible for your admins to automate theme migration process and provide command line utility that will copy all the needed files from DEV satellite to production. Unfortunately this can't be automated from KVS side and should be run via command line only due to filesystem restrictions (in most cases Apache won't have enough privileges to copy all needed files, so should be done under a more privileged user). In order to know which files should be migrated, your command line tool can parse the tar.gz archive created by KVS backup plugin. The idea is NOT to extract files from backup archive, but use it to extract filenames for the files that need to be migrated. Here is a command that will locate the latest backup archive and extract the list of filenames relative to project document root: find admin/data/backup -type f -name '*.tar.gz' -printf '%T+\t%p\n' | sort -r | awk '{print $2}' | head -n 1 | xargs tar -xvf | grep '^website/' | sed 's/website\///g' Pros: Your primary site won't be affected in any way until you manually run sync procedure. Possible to configure DEV on a separate server to secure your primary installation, if you don't want to provide your theme developers FTP access to your running project. Cons: Strict requirement to apply every single change via DEV satellite. Long time to apply any change, even very minor. Not possible to optimize performance on the fly. Hard to configure in small teams, needs command line. Creating new versions of pages on production theme This approach seems to be the most usable and best manageable for all kind of projects. Minor changes should be applied directly to production site, as they typically do not harm your project operation. When some big changes are planned, developer should follow this guideline: Duplicate page that needs to be changed into a page with new version in its ID, e.g. for view_video page it should be view_video_v2, view_video_v3 and etc. Duplication of existing page is one click from admin panel: Duplicate the affected page components if needed. E.g if working with new video list design, duplicate include_list_videos_block_common.tpl into include_list_videos_block_common_v2.tpl and switch v2 page to use this new template version instead. Work with new page version / component version without any rush and risk to harm other parts of project. You can access the new page via its direct PHP URL: https://domain.com/view_video_v2.php?id=123 When finished working with page, just change in PHP script in .htaccess rewrite to use the new _v2.php file to enable new page version into production. Deactivate the old page in KVS admin panel to make sure it will not be used and in future it will be clear that this is obsolete version. When finished working with page component, copy-paste the new code into the old page component template and remove the new page component and eliminate all usage of it. There is no sense to keep old and new page components together for history or any other purposes, as KVS keeps track of version history for all templates and will record both old and new versions of the changed component. Unlike pages, components are single files and can be easily restored to any specific version, if needed. IMPORTANT! Make sure you deactivate old page versions when switch to new page versions, or even delete them. It should be clear that specific page versions are not used anymore, otherwise you may have troubles in future, when you need to fix something and you will find yourself in the need to fix bulk of v2, v3, v4 and etc. pages, most of which are not used anymore, but you are not sure which ones. Do not keep trash in your templates! Pros: No specific configuration needed. Small changes are applied immediately. Big changes do not harm working site, and developers have enough time to work with them in their own way and pace. Cons: More manipulations needed to prepare working environment. Security considerations (should provide access to 3rd-party developers).
  6. KVS Project backup plugin can be used to either restore theme from a specific date, or to move theme from one project to another. Step1. In order to create theme backup for copy please go to Plugins -> Project backup and choose backup website option there. It will create an archive with theme backup in the backup directory configured in plugin: You can also choose any of the automated backup file, every of them contains theme backup. IMPORTANT! Theme backup also includes advertising defined in Website UI -> Advertising section, as advertising is part of theme. By using backup archive to restore theme you will also restore advertising to the date of backup. Step 2. When you have the needed backup archive, unpack it locally to some directory. Backup archive may contain multiple sub-directories, but the only needed sub-directory is website. Step 3. By using FTP client connect to your server and drag and drop the contents of website sub-directory on top. Using drag and drop is the best way to make sure that you NEVER EVER use "sync" function, because "sync" function can destroy your project without ability to restore it later. We recommended using free Filezilla FTP client: After the copying is finished, your project will have theme version from backup. Step 4. If you move theme from one project to another, it may not work correctly after copying. The reason is that theme may refer screenshot and album formats that are not available in your new project. Go to Website UI -> Theme settings and check if there are any errors displayed about formats being used. You may need to either choose another formats, or create the missing formats in your new project. Another issue could be that your theme is using some 3rd-party files, scripts, images that are not known to KVS backup plugin, so that they were not included into backup archive. Then you should typically see some 404 errors in your project when looking into Network or Console section of browser DEV tools. You should solve these by manually copying the missing files and / or sub-directories from your old project. Finally you may also experience lack of editing permissions in KVS admin panel when opening certain objects in Website UI section. To make sure you won't have this, please login to your server command line with administrative user and apply these command after opening your project www root to correct permissions for the copied files: find template -type d | xargs chmod 777 find template -type f \( ! -iname ".htaccess" \) | xargs chmod 666 find admin/data/config -type d | xargs chmod 777 find admin/data/config -type f \( -iname "*.dat" \) | xargs chmod 666 find admin/data/advertisements -type f \( -iname "*.dat" \) | xargs chmod 666
  7. Before moving KVS please make sure that your new server complies with KVS server requirements and has all required libraries installed. Please contact your host support to migrate all KVS files and database to a new server. KVS files should be put into TAR archive, so that they keep the same filesystem permissions. Once migrated, it is not recommended to switch DNS until you make sure that KVS installation on the new server is fully operational. In order to do this, you can locally switch your domain to a new IP (by adding local record into hosts file), access your site on the new server and check it. Here are steps that you should do to reconfigure KVS on a new server: Step 1. In /admin/include/setup.php update project_path option if KVS installation path was changed. Step 2. In /admin/include/setup_db.php update database connection details. Step 3. Try to login to admin panel by locally changing DNS to a new server. You should not have any issues with accessing admin panel at this point. Step 4. In admin panel go to Administration -> Installation info and make sure PHP, FFmpeg and Imagemagick libraries do not display any errors: If you see errors like "sh: 1: /usr/bin/php: not found", edit /admin/include/setup.php and fix each path that produces error to refer valid binary path for this library. Step 5. In admin panel go to Settings -> Storage servers and fix path for every local storage server that you have, if KVS installation path was changed. Step 6. In admin panel go to Settings -> Conversion servers and fix path for every local conversion server that you have, if KVS installation path was changed. Step 7. In admin panel go to Plugins -> Project backup and fix path for backup copies, if KVS installation path was changed. Step 8. In admin panel go to Administration -> Installation info and copy Cron command. Schedule this command on crontab to run every minute. Step 9. In admin panel go to Plugins -> System audit and run all checks except video content and album content. You can also run these checks if you want, but running them may take a lot of time if you have many videos and / or albums; therefore we recommend to run them later in a separate audit check. Make sure audit doesn't display any errors or fix any server configuration errors indicated by audit. Step 10. Open your site and verify its basic functions. The end. If everything is OK at this point, you can switch public DNS to a new server. If you have audit errors / warnings that you don't understand how to fix, please contact KVS support.
  8. Using KVS as a primary content manager for multiple frontends via embed codes If you have or plan a network of multiple sites that use other frontend engine, for example Wordpress, you can still benefit from KVS super powerful video management features by using KVS as you primary content manager and delivering content via KVS embed codes. You can also use this scenario with other KVS licenses (typically Basic), but the key point here is that you don't necessary need to install KVS on every site of your network, you can just use it as your primary solution. Pros: Best way to use KVS with other scripts! Content can be shared or divided between sites, no duplicate files. Single place to manage all your content storage and streaming in one, unified way. Can use ALL KVS video content management features, including multiserver, timeline screenshots, grabbers, multiformats (KVS Advanced+). Can use ALL KVS player features, player advertising and stats. Can show related videos generated by KVS inside player. Can use KVS exporting feeds (KVS Ultimate) to automate content delivery to your other sites, if they support import from feeds. Can configure individual player settings + advertising for each site using KVS embed player profiles. Can have unique titles, screenshots, comments, rating and popularity across the network. Cons: Should use iframes to deliver video player, but domains are overridden. Requires some advanced server configuration to configure aliases (see below). Requires purchasing KVS open source code option for using aliases. Price: $$$ of KVS license of your choice + open source code option ($299) + alias license for every new domain in the network ($1-$50 depending on the amount). Typically no more than $1000 for all your network if you are using Wordpress or other free software for your network sites. From the other hand you get most of killing KVS features and scale them to your network. The idea behind this scenario is that you will need to hide the domain where KVS is installed and instead use embed codes from subdomains of you other project domains. Here is an example of typical KVS embed code, where kvs-demo.com is the primary domain of your KVS installation: <iframe width="854" height="480" src="https://kvs-demo.com/embed/123" frameborder="0" allowfullscreen></iframe> If you want to embed its videos on domain2.com, you will need to create subdomain video.domain2.com that is configured as alias for kvs-demo.com. Then you can use embed codes using this subdomain: <iframe width="854" height="480" src="https://video.domain2.com/embed/123" frameborder="0" allowfullscreen></iframe> In KVS admin panel Settings -> Embed player settings you will need to create a new embed player profile for domain2.com domain. This profile will let you configuring individual player settings for all videos that are played on domain2.com. Using KVS as a primary content manager for multiple frontends via hotlinks This option is similar to the previous one, but instead of using embed iframes you can hotlink video files stored in KVS from other projects. This can also work with both KVS and other scripts, but this approach has less advantages, especially for non-KVS network. Pros: No iframe usage. Content can be shared or divided between sites, no duplicate files. Can use SOME of KVS video content management features, including multiserver, grabbers. Can use KVS exporting feeds (KVS Ultimate) to automate content delivery to your other sites. Can have unique titles, screenshots, comments, rating and popularity across the network. Cons: No multiformats is possible. No timeline screenshots. With non-KVS frontends you can't use KVS player or advertising features. Limited content migration: hotlinked content will stop working if migrated to another storage group. Video files are hotlinked from primary domain and there is no way to hide or replace it. Price: $$$ of KVS license of your choice + $$$ of other network sites either KVS or other script. Typically network KVS sites are KVS Basic licenses in this case. Using KVS satellites to build network sites KVS satellites are special license types that try to combine benefits from both having separate projects and sharing the same set or subset of content from one big database. Satellites are different from other KVS projects that they are connecting to the same database as your primary KVS does, and they are using database data directly. If you want to use KVS for all your network sites, then satellites are probably the best scheme for you. Pros: Best way to use KVS with KVS! Content can be shared or divided between sites, no duplicate files. Single place to manage all your content storage and streaming in one, unified way. Can use ALL KVS video content management, player and advertising features without any limitations. Can have unique titles and descriptions across the network (KVS Ultimate). No need to configure feeds to sync content. All content is managed from the same admin panel for all network. Cons: Requires some advanced KVS configuration to divide content between satellites if you don't want to automatically show all content from the primary database. This is typically configured by our tech support. Requires some advanced server configuration if satellites should be hosted on remote servers. Many satellites can result in database overload for big databases. Can't have unique screenshots, comments, rating and popularity across the network. Shares the same members database for all sites. Price: $$$ of KVS Ultimate license + KVS Satellite license for each network site ($99 - $249 depending on the amount).
  9. KVS can be used as a backend for any other frontend technology, such as mobile apps, rich desktop apps and etc. While KVS doesn't have API in its traditional sense, virtually any API can be created using KVS Website UI builder feature. In this article we will provide example on creating JSON API for displaying list of videos, video player and data for any video, as well as processing signup and login actions. The very same approach can be extended to any other data supported by KVS: categorization, posts, photos and other. It is expected that you also have some client code (typically implemented using some other technology) that can send HTTP GET / POST requests, parse JSON responses and render data in some way. This code is up to you and not explained in this article. Creating API page The idea is to create a single page that will host all blocks providing the needed data and functionality. You will need this page to set up block settings. Then you will use async method of querying and posting data to communicate with individual blocks on this page. First, create a new page In Website UI -> Pages section of admin panel. Give it any name (e.g. API) and any external ID (e.g. api). Add 4 blocks to this page: list_videos block to query various lists of videos with different sorting and filtering options; video_view block to query data for each video; signup block to process signup requests and register new users; logon block to process login requests and authenticate existing users. There is no need to do any code formatting here, as we are not going to display this page in a direct way: {{insert name="getBlock" block_id="list_videos" block_name="API videos"}} {{insert name="getBlock" block_id="video_view" block_name="API video view"}} {{insert name="getBlock" block_id="signup" block_name="API signup"}} {{insert name="getBlock" block_id="logon" block_name="API logon"}} After you save this page, you will see 4 blocks appear under it where you need to configure options and their templates. Displaying video list Open API videos block for editing. In template use the following code: {{php}} header('Content-Type: application/json'); {{/php}} [{{foreach name="data" item="item" from=$data}} { "video_id": {{$item.video_id|default:0}}, "title": {{$item.title|json_encode}}, "description": {{$item.description|json_encode}}, "duration": {{$item.duration|default:0}}, "screen_url": {{$item.screen_url|json_encode}}, "screen_main": {{$item.screen_main|default:0}}, "screen_amount": {{$item.screen_amount|default:0}}, "video_viewed": {{$item.video_viewed|default:0}}, "rating": {{$item.rating|default:0}}, "rating_amount": {{$item.rating_amount|default:0}}, "post_date": {{$item.post_date|json_encode}}, "view_page_url": {{$item.view_page_url|json_encode}}, {{if count($item.categories)>0}} "categories": [{{foreach name="data_categories" item="item_categories" from=$item.categories}}{"id": {{$item_categories.category_id|default:0}}, "title": {{$item_categories.title|json_encode}}, "dir": {{$item_categories.dir|json_encode}}}{{if !$smarty.foreach.data_categories.last}},{{/if}}{{/foreach}}], {{/if}} {{if count($item.tags)>0}} "tags": [{{foreach name="data_tags" item="item_tags" from=$item.tags}}{"id": {{$item_tags.tag_id|default:0}}, "title": {{$item_tags.title|json_encode}}, "dir": {{$item_tags.dir|json_encode}}}{{if !$smarty.foreach.data_tags.last}},{{/if}}{{/foreach}}], {{/if}} {{if count($item.models)>0}} "models": [{{foreach name="data_models" item="item_models" from=$item.models}}{"id": {{$item_models.model_id|default:0}}, "title": {{$item_models.title|json_encode}}, "dir": {{$item_models.dir|json_encode}}}{{if !$smarty.foreach.data_models.last}},{{/if}}{{/foreach}}], {{/if}} {{if count($item.content_source)>0}} "content_source": {"id": {{$item.content_source.content_source_id|default:0}}, "title": {{$item.content_source.title|json_encode}}, "dir": {{$item.content_source.dir|json_encode}}}, {{/if}} {{if count($item.dvd)>0}} "dvd": {"id": {{$item.dvd.dvd_id|default:0}}, "title": {{$item.dvd.title|json_encode}}, "dir": {{$item.dvd.dir|json_encode}}}, {{/if}} {{if count($item.user)>0}} "user": {"id": {{$item.user.user_id|default:0}}, "display_name": {{$item.user.display_name|json_encode}}}, {{/if}} "type": "{{if $item.is_private==2}}premium{{elseif $item.is_private==1}}private{{else}}public{{/if}}", "status": "{{if $item.status_id==0}}inactive{{elseif $item.status_id==1}}active{{elseif $item.status_id==2}}error{{elseif $item.status_id==3}}processing{{elseif $item.status_id==4}}deleting{{elseif $item.status_id==5}}deleted{{/if}}", "is_hd": {{if $item.is_hd==1}}true{{else}}false{{/if}} }{{if !$smarty.foreach.data.last}},{{/if}} {{/foreach}}] This code is designed to render list of video items in JSON formatting instead of typical HTML formatting. NOTE: there are basically 2 general rules of rendering JSON code with Smarty template. Use |json_encode modifier to format strings, as strings need some quoting using double quotes and escaping of system characters. Also use |default:0 modifier to format numbers, this will make sure that at least 0 will be displayed and JSON formatting will not be broken. In block parameters do the following: make sure you configure items_per_page and enable var_items_per_page if you want to display lists with different number of items per page; make sure you enable var_from parameter to be able to use pagination; make sure you configure sort_by and enable var_sort_by; enable all var_xxx parameters under Dynamic filters; you can use them for displaying filtered lists, e.g. by category, or by tag; enable var_search parameter and configure other search related options as needed under Search videos by text; enable show_categories_info, show_tags_info, show_models_info, show_content_source_info, show_dvd_info, show_user_info under Select additional data for each video only for data that you want to display in your list; please note that these parameters have a huge performance impact. Now if your page was created with api external ID, you can display your videos list sending GET request to this base URL: https://kvs-demo.com/api.php?mode=async&function=get_block&block_id=list_videos_api_videos NOTE: if you want to query data from another block (e.g. categories list, albums list), replace list_videos_api_videos in URL with the unique ID of your other block added to API page. In Firefox, you should see this URL formatted as JSON array: In order to use pagination, sorting or filters, simply add the needed parameters to the base URL: https://kvs-demo.com/api.php?mode=async&function=get_block&block_id=list_videos_api_videos&from=2 https://kvs-demo.com/api.php?mode=async&function=get_block&block_id=list_videos_api_videos&sort_by=rating https://kvs-demo.com/api.php?mode=async&function=get_block&block_id=list_videos_api_videos&category_id=2 Displaying video info Open API video view block for editing. In template use the following code: {{php}} header('Content-Type: application/json'); {{/php}} { "video_id": {{$data.video_id|default:0}}, "title": {{$data.title|json_encode}}, "description": {{$data.description|json_encode}}, "duration": {{$data.duration|default:0}}, "screen_url": {{$data.screen_url|json_encode}}, "screen_main": {{$data.screen_main|default:0}}, "screen_amount": {{$data.screen_amount|default:0}}, "video_viewed": {{$data.video_viewed|default:0}}, "rating": {{$data.rating|default:0}}, "rating_amount": {{$data.rating_amount|default:0}}, "post_date": {{$data.post_date|json_encode}}, "view_page_url": {{$data.canonical_url|json_encode}}, {{if count($data.categories)>0}} "categories": [{{foreach name="data_categories" item="item_categories" from=$data.categories}}{"id": {{$item_categories.category_id|default:0}}, "title": {{$item_categories.title|json_encode}}, "dir": {{$item_categories.dir|json_encode}}}{{if !$smarty.foreach.data_categories.last}},{{/if}}{{/foreach}}], {{/if}} {{if count($data.tags)>0}} "tags": [{{foreach name="data_tags" item="item_tags" from=$data.tags}}{"id": {{$item_tags.tag_id|default:0}}, "title": {{$item_tags.title|json_encode}}, "dir": {{$item_tags.dir|json_encode}}}{{if !$smarty.foreach.data_tags.last}},{{/if}}{{/foreach}}], {{/if}} {{if count($data.models)>0}} "models": [{{foreach name="data_models" item="item_models" from=$data.models}}{"id": {{$item_models.model_id|default:0}}, "title": {{$item_models.title|json_encode}}, "dir": {{$item_models.dir|json_encode}}}{{if !$smarty.foreach.data_models.last}},{{/if}}{{/foreach}}], {{/if}} {{if count($data.content_source)>0}} "content_source": {"id": {{$data.content_source.content_source_id|default:0}}, "title": {{$data.content_source.title|json_encode}}, "dir": {{$data.content_source.dir|json_encode}}}, {{/if}} {{if count($data.dvd)>0}} "dvd": {"id": {{$data.dvd.dvd_id|default:0}}, "title": {{$data.dvd.title|json_encode}}, "dir": {{$data.dvd.dir|json_encode}}}, {{/if}} {{if count($data.user)>0}} "user": {"id": {{$data.user.user_id|default:0}}, "display_name": {{$data.user.display_name|json_encode}}}, {{/if}} "type": "{{if $data.is_private==2}}premium{{elseif $data.is_private==1}}private{{else}}public{{/if}}", "status": "{{if $data.status_id==0}}inactive{{elseif $data.status_id==1}}active{{elseif $data.status_id==2}}error{{elseif $data.status_id==3}}processing{{elseif $data.status_id==4}}deleting{{elseif $data.status_id==5}}deleted{{/if}}", {{if $data.status_id==5}} "delete_reason": {{$data.delete_reason|json_encode}}, {{/if}} {{if count($data.formats)>0}} "files": [{{foreach name="data_formats" item="item_formats" from=$data.formats}}{"postfix": {{$item_formats.postfix|json_encode}}, "duration": {{$item_formats.duration|default:0}}, "filesize": {{$item_formats.file_size|default:0}}, "url": {{$item_formats.file_url|json_encode}}}{{if !$smarty.foreach.data_formats.last}},{{/if}}{{/foreach}}], {{/if}} "is_hd": {{if $data.is_hd==1}}true{{else}}false{{/if}} } In block parameters make sure to enable var_video_id parameter. Use the following GET request to query video data for any specific video by passing its ID in the URL parameters: https://kvs-demo.com/api.php?mode=async&function=get_block&block_id=video_view_api_video_view&id=123 In Firefox, you should see this URL formatted as JSON object: Sending signup request Open API signup block for editing and modify its parameters as needed. Probably you need to activate disable_captcha parameter so that captcha is not required during signup. There is no need to change anything in template, because in most cases you will render signup form in your app and will only use KVS signup block to process requests. In cases with paid access you will need to display access packages to your users, then use this template code: {{php}} header('Content-Type: application/json'); {{/php}} [{{foreach name="data" item="item" from=$card_packages}} { "access_package_id": {{$item.package_id|default:0}}, "title": {{$item.title|json_encode}} }{{if !$smarty.foreach.data.last}},{{/if}} {{/foreach}}] In order to use signup functionality you should send POST request to the following base URL: https://kvs-demo.com/api.php?mode=async&function=get_block&block_id=signup_api_signup To see which fields should be sent, take a look at default template of signup block, which renders all supported fields: action = signup username = <username> pass = <password> pass2 = <password confirmation> email = <email> ... Also make you to include these fields with each POST request to make sure response is formatted correctly: mode = async format = json As a result of your POST request you should get success or failure response with the list of errors. Sending login request Login functionality is very similar to signup. Open API logon block and configure parameters as needed. Ignore its template code. In order to log user in you should send POST request to the following base URL: https://kvs-demo.com/api.php?mode=async&function=get_block&block_id=logon_api_logon Specify the following data in POST fields: mode = async format = json action = login username = <username or email> pass = <password> As a result of your POST request you should get success or failure response with the list of errors. NOTE: KVS uses PHP session functionality to manage user sessions. This functionality sends PHPSESSID cookie with every response and requires you to send it back with every request. You must send this cookie with every request to have member-specific functionality working.
  10. Please follow these steps to configure your VestaCP to use KVS Nginx rules. 1) Find out which rules you need first. Go to Settings -> Storage servers and open every storage that is located on this specific physical server (usually Local Videos and Local Albums). Each storage server displays Nginx config rules that you should add (storage servers for albums typically do not have any rules): Copy-paste all rules into the same text file one by one, if you have them from multiple storage servers. 2) Use WinSCP program to connect to your server via SFTP protocol as a root user. Open /home/admin/conf/web directory and create 2 text files in this directory: nginx.kvs-demo.com.conf_kvs snginx.kvs-demo.com.conf_kvs NOTE: replace kvs-demo.com with your domain name, you can see some similar files in this directory and you can check how your domain name is spelled in these files. Use the same spelling. Put the same nginx rules into both created files: the rules that you've copied on step 1. 3) Login to VestaCP with root account. Go to Server tab on the top. Find Nginx service, mouse over it and use restart option: 4) Finished. In order to check, go to Plugins -> System audit in KVS admin panel and run Installation, Servers and Content Protection checks. You should not have any errors and warning regarding content protection.
  11. Multiple conversion servers can be used only in KVS ultimate package. They will let you reduce CPU load on main server and make video conversion faster, but only to some point. It is a common misunderstanding to assume that the more conversion servers you add, the more videos can be converted for the same time. This is not always true. The overall conversion speed depends not only on the actual conversion (e.g. video encoding), but on many other factors as well. Please read more about KVS conversion engine here. Adding new conversion server in KVS System requirements for a conversion server in KVS: PHP 7.1+ IonCube Loader 10.2+ (not required if your have open source code option with your license) PHP Client URL Library (curl) PHP FTP PHP Image Processing and GD PHP.ini disable_functions should not contain "exec" FFmpeg 1.0+ with libx264, libavfilter and AAC codec (libfaac, libfdk_aac or native ffmpeg aac codec) ImageMagick You can add a content server in admin panel in Settings -> Conversion servers. For Maximum tasks option it is recommended to keep it in 5-10 interval. This option doesn't mean how many tasks are executed in parallel; instead it affects how many tasks are uploaded to this conversion server. High values for this option may result on overall conversion performance degradation. For Optimize content copying options we provided complete explanation in this post. The next set of options are related to server connection. KVS uses these settings to copy tasks to conversion servers. In most cases you will need to specify FTP connection details here. The most confusing option here can be FTP folder. In order to specify it correctly you should first login to your FTP using standard FTP client and see where you come into. It can be possible that your FTP is directly configured to the needed folder, but in most cases FTP will be configured into home folder of FTP user or www root folder. NOTE: conversion folder doesn't require any HTTP access to it. Therefore it can be ANY folder on your remote server, but it should be unique and should belong to only 1 conversion server in KVS. Here is an example configuration for a remote conversion server: Configuring cron on remote conversion server NOTE: on conversion server with local connection you don't need to add any cron schedule for it, it will be automatically executed by KVS engine. After conversion server is created in KVS and its connection is validated, KVS will copy remote_cron.php file into the specified remote folder. This file is needed to perform remote conversion tasks. In order for it to start working, you should put it on cron every minute using the following command (please note that you should specify the valid filesystem path to remote_cron.php script): php /path/to/remote_cron.php > /dev/null 2>&1 Once configured, this script will create several files in the same folder, which will mean that this command works fine. KVS will change status for this conversion server from Initializing to Active within 5 minutes. After switching to Active status this server will be utilized by KVS conversion engine and will start processing conversion tasks. Troubleshooting issues KVS will validate basic issues when you try to save server settings in admin panel. After you add server, KVS will validate it on background every 5 minutes to check if it operates successfully. Even if initially you didn't have any errors, new errors may appear later due to various factors. First, FTP connection or remote server configuration may be changed externally and some functionality will simply stop working. All issues found on background are immediately reported to KVS start page as they all are considered CRITICAL and may indicate that your remote server is not working correctly and conversion may be blocked. You should make sure to fix them ASAP. Errors from background checks are not very detailed and just indicate some set of issues. In order to get more details you should try to save server settings in admin panel. NOTE: if server reports an error and you have already fixed it, please give it 5 minutes to do re-check and verify this error is fixed. Until that, server may still show this error. This only applies for background checks on existing servers. When you save server settings in admin panel, all issues are validated right a way without any delay. If saving server in admin panel still shows validation errors, these errors are not yet fixed. Here is the list of errors you can get when saving server settings: - This connection folder is already used by another server. This issue means that you are trying to configure this server into a folder, which is already used by another storage or conversion server. You should never do this, each storage or conversion server in KVS should be configured into a separate folder on filesystem. - Unable to connect to host : post. KVS is not able to connect to the specified FTP host or port. If the entered data is valid, most probably your FTP is protected by firewall and you should make sure that your main server's IP is whitelisted. Also sometimes your FTP may be configured for using non standard FTP port, you should check this as well. - Unable to login with credentials provided. Either FTP username or password is not valid. - Put / get / chmod / delete operations failed, insufficient permissions possible. When validating server connection, KVS will try to put a test file to the server and then delete it. You will get this error if any of the mentioned operations failed, which probably indicates wrong FTP folder or FTP configuration issue. Try to log in to FTP manually using desktop FTP client and try to copy any file into the specified folder. Can you do this manually? Also this error can happen if /tmp folder on your main KVS installation does not exist or is not writable. In order to check that go to Plugins -> Audit and run installation check. It will show error for tmp folder if anything is wrong. - No PHP extension for FTP was found. Your remote server's PHP doesn't have support for FTP module and therefore it is not possible to enable allow this server to copy content to storage servers option for this server. - No PHP extension for CURL was found. Your remote server's PHP doesn't have support for CURL module and therefore it is not possible to enable allow this server to pull source files from primary server option for this server. - Conversion script not configured / not working on this server. - Conversion script is not working. - Conversion script executed more than 15 minutes ago. These errors indicate that your remote server either doesn't have a cron task to execute remote_cron.php script every minute, or executing this script results in critical PHP error. Please check if you have cron task set. If you have it, then try executing this command manually from command line to see its output (please note that you should specify the valid filesystem path to remote_cron.php script): php /path/to/remote_cron.php In some cases if your remote server has another timezone than your main server, KVS may think that its remote_cron.php script is not executed, while it does. Open conversion server settings in KVS admin panel and specify its timezone offset under Configuration. Save conversion server settings and give it 5 minutes to re-check and remove this error. - Some libraries are not configured correctly on this server. This error indicates that KVS was not able to locate ffmpeg / imagemagick executables on your remote server. First of all you should make sure that these libraries are installed on the server. If not - please install them. If the libraries are installed, then most probably their binaries are not located using standard paths. Open conversion server settings in KVS admin panel and specify the correct paths for libraries that were not detected correctly under Configuration. Save conversion server settings and give it 5 minutes to re-check and remove this error.
  12. Starting from KVS 4.0.0 it is possible to configure that admin panel is available via URL other than /admin. Here is how. Step 1. Open /admin/.htaccess file for editing and uncomment (remove #) the following lines. If you don't have them in your /admin/.htaccess, that's mean that your project was started with earlier version and you simply need to add them at the very end: RewriteCond %{ENV:REDIRECT_STATUS} !200 RewriteCond %{REQUEST_URI} ^/admin RewriteCond %{REMOTE_ADDR} !^88.85.69 RewriteCond %{HTTP:X-REAL-IP} !^88.85.69 RewriteRule ^.*$ - [R=404,L] In the same file comment out (add #) line starting with ErrorDocument 404: #ErrorDocument 404 "404 / not found" NOTE: this configuration is designed to allow KVS support engineers to access your admin panel via standard /admin URL, while all other users including yourself will see 404 error. We will not provide any support if we are not able to access your admin panel via standard /admin URL, so please do not alter this configuration. Step 2. Create a symlink on your server's filesystem pointing from your new folder to the existing /admin folder. You can do that via your server panel or via command line. Via command line you should first CD to your project folder and then execute the following LN command: ln -s admin abcde Step 3. In the main /.htaccess file check if you have the following fragment: RewriteCond %{HTTP_HOST} !^www\.(.*)$ RewriteCond %{REQUEST_URI} !^/admin RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L] You should have it if your project URL is www-based. Add additional line to this fragment to exclude /abcde folder: RewriteCond %{HTTP_HOST} !^www\.(.*)$ RewriteCond %{REQUEST_URI} !^/admin RewriteCond %{REQUEST_URI} !^/abcde RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L] Step 4. In /admin/include/setup.php add the following line: $config['admin_url']="$config[project_url]/abcde"; Step 5. Now you should be able to access your admin panel only via this URL: http://domain.com/abcde/ You can replace abcde with anything you want. You should get 404 error when you try to access via standard admin panel URL: http://domain.com/admin/ NOTE: In some cases your web server (Apache or Nginx or both) may be configured to disallow using symlinks. If you see 403 errors when trying to access admin panel via the new URL, please ask host support to allow symlinks, otherwise you won't be able to hide admin panel main URL.
  13. By default KVS comes with local storage servers for videos and albums (if ultimate package). When you add a new storage server the first thing you should ask yourself is whether you want it to be in a new server group or in an existing server group. The difference is described in details in this article: Storage system in KVS tube script Here is short summary. New server group: You want to extend storage space. You want new content to be copied to new server, while old content should remain on old server. Existing server group: You want to load balance content traffic between multiple servers. You want to migrate existing content to a new server. NOTE: content servers for videos and albums work in exactly same way, so we will only describe that for videos. How to migrate your existing content to a new server or CDN The most common scenario is when you already have local storage and want to migrate to a remote server or CDN. In order to do that you should do the following steps: Step 1. Add a new content server into the same storage group where your old server is located. Don't worry, the new server will be added in Disabled status, so it won't affect your site users. You can find more info about adding new storage servers below. Step 2. Start content sync process for the new storage server. This process can be started in servers list in KVS admin panel. It will automatically copy all content stored in the group to a new server. NOTE: sync process will create a background task and you will be able to see its progress in the list of background tasks. Based on how many content you have, this task may take days and even weeks and it will be interrupted by processing new videos if any. If you want to manually copy content files via FTP, you can do that and skip this step. Step 3. When sync process is over, if possible verify the size of content folders on both servers to make sure they have the same size. At the same time verify that KVS is not showing any errors for the new server. There will be errors until all content is synced, but there should not be any errors afterwards. Step 4. Enable new server in storage group and disable the old one. Now your users will see content from the new server. Step 5. When you are sure there are no issues, delete old server. NOTE: KVS will stop copying new videos to the old server only after you delete it from KVS. Please make sure you remember where video files are stored on filesystem before deleting old server from KVS, see step 6 for more details. Step 6. When deleting server from KVS in step 5, KVS won't physically delete any video files there. Deleting a storage server from KVS only removes it from KVS records and doesn't affect anything on filesystem. This is done for security reasons, otherwise you could accidentally remove storage server from KVS and delete all your videos files. So the only way to delete video files from the old server (e.g. free the disk space) is to do that manually from server side. We recommend you to wait for 5-7 days after deleting old storage server from KVS so that you are 100% sure that all your site is working without any issues and all videos are playing fine. When you are sure everything is OK, you are good to delete old video files from server HDD. How to add a new content server System requirements for a content server in KVS: PHP 7.1+ No specific PHP modules required Apache and / or Nginx (recommended for better performance and content protection) NOTE: Apache is NOT strictly required for remote content server, you can have Nginx + PHP. You can add a content server in admin panel in Settings -> Storage servers. For server URL you should specify any URL that you want your content to be served from. It is a common practice to use IPs and subdomains here, as well as subfolders. It is not recommended to store content in www root folder, as this may bring some problems in future. So here is the recommended URL patterns: http://123.124.125.126/videos http://storage1.domain.com/videos http://storage2.domain.com/videos NOTE: if your site works via HTTPS, all your storage servers should also use HTTPS. This is why it is better to use subdomains here, as SSL certificates can support wildcard (*) subdomains and you can install the same certificate on all storage servers. Streaming type is an important option, which indicates the type of your storage server. If this server is external CDN provider, then you should select CDN (CDN configuration for videos and albums is a topic of another article, will not be covered here). If your server doesn't have nginx installed, then you should choose HTTP 302 redirect. This option means that KVS will redirect to video files directly without any protection. Video files which are available via direct links can be easily hotlinked by other sites and someone can be stealing your traffic. This is the common issue with wordpress and other scripts, they do not allow protecting your video files. KVS keeps this option for specific cases, but its usage is not recommended. In most cases your storage server should have nginx installed and in this case you should select nginx streaming type. The next set of options are related to server connection. KVS uses these settings to copy files to remote servers. In most cases you will need to specify FTP connection details here. The most confusing option here can be FTP folder. In order to specify it correctly you should first login to your FTP using standard FTP client and see where you come into. It can be possible that your FTP is directly configured to the needed folder, but in most cases FTP will be configured into home folder of FTP user or www root folder. Since your content will be stored somewhere in subfolder (e.g. http://storage1.domain.com/videos), you should specify RELATIVE path to this subfolder in this field. For example if your FTP is configured into www root (http://storage1.domain.com), then you need to specify: videos If your FTP is configured into user's home folder, then you will need to specify more subfolders to come to /videos: public_html/videos or www/videos or even data/domain.com/public_html/videos NOTE: each storage or conversion server in KVS should have unique folder. Do not configure different servers into the same folder on filesystem, this may result in data loss. Sometimes if you specify wrong FTP folder KVS will show error that it is not able to validate connection. However in many cases there will be no error, and the files will be copied to the wrong place and will not be available to the outside. Then after you add some videos to this server KVS will show an error on it, indicating that video files are not working from this server. Control script URL field is not editable. This field is built automatically from the URL field you specified above. It indicates where you should put KVS control script on this server, so that it is integrated with KVS. Control script serves 2 things: it provides info about server (its load and disk space) and implements protection for your content. There is a link near by to download this script and you should copy it manually to the storage server so that it is available at the displayed Control script URL. So if your storage server has this URL: http://storage1.domain.com/videos Then you should copy control script here: http://storage1.domain.com/remote_control.php You can manually run this script via browser and make sure it is working and returns "connected" word. Until this happens, you won't be able to save this server. Finally, there is Time offset field. In order to implement content protection KVS generates links which expire after some time (usually after 1 or 2 hours). In order to have this working, it is required that timezones on both servers are synced. If you don't want to configure the same timezone on your remote server, then you need to specify time offset, e.g. how many hours your storage server's timezone is behind or ahead in comparison to main server. However due to different daylight saving concepts in US and Europe it can be possible that after some time this difference will be shifted 1 hour back or forth. So the best way to ensure that remote server will not have any problem is to configure the same timezone on main server and remote server. Then you will not need to specify any time offset. Here is an example configuration for a remote storage server: Finalizing protection for nginx After the server is added, open it for editing. You may see that in server settings there is a textarea with nginx config displayed (if your Streaming type is set to nginx): You should add this piece of code into nginx config of your storage server to make sure that protected files are not available via direct links. After modifying nginx config you should restart nginx. There is no common guide on where do you find your nginx config. It depends on your server panel vendor. Most server panels do allow restarting nginx from panel GUI, but do not allow modify nginx config directly. You should figure this out with your host support. But if you do not configure this, your video files will still be available via direct links and no protection will be possible. CDN storage When adding CDN storage you should use CDN option in Streaming type field. Then you also need to put your CDN control script into /admin/cdn folder (create this folder as it doesn't exist by default), specify its name in CDN control script field and specify your secret key in Streaming key field: CDN control script is a PHP script that should be implemented by your CDN provider. This script implements content protection logic by creating temporary links to video or image files. Moreover, this script is responsible for invalidating content on CDN servers when files are replaced (modified) or deleted. NOTE: invalidation process may be very important for a tube site. Consider you have DMCA claim that requires you to delete copyrighted content. If invalidation is not working correctly, your CDN will continue to stream video files that should return 404 instead. Thus you may experience troubles with providing proof of deletion. Each CDN provider has its own API for protection and invalidation, there are no standards in this field. Therefore KVS requires that each provider implements their API and provides their CDN control script to customers for use in KVS. If no such script is provided, it will still be possible to use this CDN in KVS with default CDN control script, but no content protection or invalidation will be implemented and you will be missing these important features. CDN providers: if you are willing to implement CDN control script for your CDN, just ask customer to send you default CDN control script that can be downloaded in admin panel. This script provides a basic skeleton with all the needed functions having empty or basic implementation. If you want to use default CDN control script: Download default CDN control script and upload it to /admin/cdn folder. Specify cdnapi.php in CDN control script field. Specify any text in Streaming key field as this value is not used by default control script. Troubleshooting issues KVS will validate basic issues when you try to save server settings in admin panel. After you add server, KVS will validate it on background every 5 minutes to check if it operates successfully. Even if initially you didn't have any errors, new errors may appear later due to various factors. First, FTP connection or remote server configuration may be changed externally and some functionality will simply stop working. Also when you add a server which doesn't have any videos yet, KVS is not able to check if videos are streamed correctly or not. Only after you add some videos, this check will happen on background. All issues found on background are immediately reported to KVS start page as they all are considered CRITICAL and may indicate that your remote server is not working correctly and users are not able to see videos or photos. You should make sure to fix them ASAP. Errors from background checks are not very detailed and just indicate some set of issues. In order to get more details you should try to save server settings in admin panel. NOTE: if server reports an error and you have already fixed it, please give it 5 minutes to do re-check and verify this error is fixed. Until that, server may still show this error. This only applies for background checks on existing servers. When you save server settings in admin panel, all issues are validated right a way without any delay. If saving server in admin panel still shows validation errors, these errors are not yet fixed. Here is the list of errors you can get when saving server settings: - This connection folder is already used by another server. This issue means that you are trying to configure this server into a folder, which is already used by another storage or conversion server. You should never do this, each storage or conversion server in KVS should be configured into a separate folder on filesystem. - Unable to connect to host : post. KVS is not able to connect to the specified FTP host or port. If the entered data is valid, most probably your FTP is protected by firewall and you should make sure that your main server's IP is whitelisted. Also sometimes your FTP may be configured for using non standard FTP port, you should check this as well. - Unable to login with credentials provided. Either FTP username or password is not valid. - Put / get / chmod / delete operations failed, insufficient permissions possible. When validating server connection, KVS will try to put a test file to the server and then delete it. You will get this error if any of the mentioned operations failed, which probably indicates wrong FTP folder or FTP configuration issue. Try to log in to FTP manually using desktop FTP client and try to copy any file into the specified folder. Can you do this manually? Also this error can happen if /tmp folder on your main KVS installation does not exist or is not writable. In order to check that go to Plugins -> Audit and run installation check. It will show error for tmp folder if anything is wrong. - Control script failure. As we mentioned in this article, for remote storage servers you need to manually copy control script to make it available under the displayed Control script URL. You will get this error if KVS is not able to connect to it. Try opening control script URL in browser, do you see "connected" word printed? If you don't see it, then most probably you didn't copy control script to the mentioned location, or copied it to the wrong FTP location, or there is an issue with running PHP scripts on your storage server. If script works in browser but you still see this error, it can indicate that your main server is not able to connect to this URL due to DNS or other routing issue on your main server. You can check that by using server command line and typing the following command with your control script URL: curl -I http://storage1.domain.com/remote_control.php - Remote server time is not synchronized with primary server time. As we said already, it is recommended that PHP timezones on both servers are synced. You can get rid of this error by specifying timezone offset either positive (e.g. 2) or negative (e.g. -2). This error will show timestamps on both servers to give you clue how many hours you should specify. - This script is configured with another secret key, please update its secret key. Each remote control script has secret key hardcoded in it for protection. In some cases, specifically if you use multiple KVS installations and for each of them configure the same remote storage server, you can get this error. If you already had remote_control.php script on your storage server, then most probably it is already used by other KVS installation. If you indeed have other KVS configured with the same storage server, better contact support to make sure you don't harm another installation. If you modify secret key in remote_control.php and it turns out that this file is also used by another KVS, it will stop working there. Troubleshooting content check found errors The final validation that happens for every storage server is verifying that random videos can be played. If this check fails, you will see content check found errors issue displayed for server. You can further open content test page to see test logs, which include HTTP headers logs. Here are possible reasons: Your server doesn't have nginx installed but in KVS settings you set its streaming type as nginx. In this is true, then you need to change server's streaming type option to 302 redirect. Your nginx is not configured correctly, you should ask your host support to make sure that nginx configuration printed in KVS server settings was correctly added to nginx config for this server domain. CDN API script is not working as expected or the issue is at CDN provider's end. If your server is CDN, please open content test log for this server and send HTTP headers log to your CDN provider to describe the issue. Your Apache is configured with MultiViews option enabled, which prevents KVS from serving content correctly. In this case content test HTTP headers log will show 404 error. The requested file is missing on your server and thus returns 404 error which you can see in content test HTTP headers log. In most cases this happens because your FTP configuration has been changed externally and suddenly FTP user's home folder was changed to another one. KVS started copying new files to another location and of cause these new files are no more available under the old URL, configured in KVS server settings. You should login with FTP manually and check if its location is the same as what you have specified in server URL. If the location is different, then you should check with your host support where the correct location is and ask them to move content files from this new location to the old location and re-configure FTP user back to have home folder at the old location. For example your URL is configured as http://storage1.domain.com/videos and FTP access was configured directly into this folder. As time passed, KVS put many content into this folder but then suddenly your host support changed FTP access directly to domains www folder, e.g. this one: http://storage1.domain.com. The new files are no more copied under /videos folder, but copied under / folder instead. These new files will no more be available under http://storage1.domain.com/videos URL and KVS will report content check error.
  14. Here are some important notes and prerequisites before you start In order to use HTTPS on your site you should purchase SSL certificates for your domain and all subdomains you are using with KVS project. This includes all remote storage servers as well, since any files loaded on your project, including video files should be served via HTTPS to get the full coverage. HTTPS may produce additional load on your server because of additional layer of traffic encryption. If you are using Nginx, HTTPS should be configured at Nginx level. Nginx serves static files and they need to be served via HTTPS as well. All 3rd-party scripts and advertising you are using should support HTTPS as well, otherwise they will trigger warnings in browsers and will distract your users. How to enable HTTPS in KVS tube script Step 1. Configure SSL at server level for domain and all subdomains you are using for KVS project. This should be done at Nginx level for projects that work via Nginx. If you are using CDN or remote storage servers, check how HTTPS works for all of them. NOTE: configuring HTTPS at server level is not covered by this guide. Please refer to Nginx / Apache official documentation on this. Step 2. In admin panel go to Settings -> Storage servers and for each storage server modify URL field to point to https://, e.g.: https://yourdomain.com/contents/videos Step 3. In /admin/include/setup.php change all URLs to https://. In most cases you only need to change this setting: $config['project_url']="https://www.kvs-demo.com"; However there can be other settings referring direct URLs as well. So search the whole file for http:// and change all usages to https://. NOTE: KVS will reset all cache after you change project URL. If you have much traffic on your site, your server may be overloaded for some time until the new cache is populated. Step 4. In main .htaccess file change all URLs to https:// as well. In most cases you will only have this line: RewriteRule ^(.*)$ https://www.%{HTTP_HOST}/$1 [R=301,L] Step 5. Open your site via HTTPS protocol and make sure that everything is displayed correctly. Starting from this point your site will fully work on HTTPS. Go to Plugins -> System audit and run installation and server checks there. You should not have any errors from these 2 checks. Step 6. It is recommended to configure 301 redirect for all HTTP requests to HTTPS so that there is no duplicate content available under different protocols. This redirect should be set globally in Nginx configuration (or Apache configuration if your server is not running under Nginx). NOTE: configuring redirect at server level is not covered by this guide. Troubleshooting Design is not displayed properly when using HTTPS. Most probably you didn't switch all static resources to be loaded via https://. Open source code of your page and search for http:// text. Once you located the URL of static resource referred by http://, go to Website UI -> Search in templates in admin panel and try searching for template which renders this URL. Fix to https://. On some pages browser shows insecure warning. This problem is caused by the same issue as above. Some parts of your page are trying to use resources via insecure HTTP protocol and that's why browser shows the warning.
×
×
  • Create New...