How to Install AVideo/YouPHPTube on Ubuntu 20.04 Server

This tutorial is going to show you how to run your own video-sharing website with AVideo (formerly YouPHPTube) on Ubuntu 20.04. AVideo is an open-source, self-hosted alternative to video-sharing websites like YouTube, Vimeo, etc. With AVideo, users can upload videos to your server and share it with the Internet.

AVideo Features

  • Unlimited and simultaneous live streams and you can have unlimited users connected to each live stream.
  • Import and encode videos from other sites directly from the Internet
  • Bulk encoding from local video directory
  • Make private videos
  • Totally integrated function with Youtube, syncing your videos with Youtube
  • Transcode multiple formats of multimedia files to MP4, WebM and MP3 file
  • Support Amazon S3 (Simple Storage Service)
  • Responsive site layout. AVideo looks incredible on any device. (You can choose YouTube or Netfilx style layout.)
  • User channels and user playlists
  • Subscribe to channels you like
  • You can monitor the performance of your videos with up-to-date metrics and reports in AVideo Statistics.
  • Extend site functionalities with plugins.
  • SEO Optimized
  • iOS and Android apps available

avideo-self-hosted-alternative-to-youtube-ubuntu-20.04

AVideo Server Requirements

First, you should know that a single-core CPU is not viable for a video sharing website, because the encoding process will use a lot of CPU resource.

Then choose the server specs in accordance with the number of users your site have.

  • If you just want to use it to share your own videos, you need a server with at least 2 CPU cores and 4GB RAM. You can buy a powerful VPS (virtual private server) from Contabo with very little cost.
  • If you expect you site to have dozens of users, then you can consider the Contabo extra large VPS, which has 10 CPU cores, 60GB RAM, 1Gbit/s port speed, 1.6TB disk space, unlimited traffic but costs just 26.99 Euros/month.
  • When your site grows beyond that, you should buy a dedicated server.

Software Requirements for Installing AVideo on Ubuntu 20.04

AVideo requires PHP and MySQL/MariaDB. To follow this tutorial, you should have already set up a LAMP stack or LEMP stack. If you prefer to use Apache web server, then install LAMP stack.

If you prefer to use Nginx web server, then install LEMP stack.

Note: AVideo support with Nginx is only experimental. Your site may have issues if you use Nginx.

You also need a domain name. I registered my domain name at NameCheap because the price is low and they give whois privacy protection free for life.

AVideo is comprised of two parts.

  • The main part is the front end stream server, which allows users to watch existing videos.
  • The other part is the encoder, which allows users to upload their videos.

The public encoder uses the domain name https://encoder1.avideo.com. If you don’t want users to leave your site when uploading videos, you need to set up your private encoder. I will show you how in this article. Without further ado, let’s get started.

Step 1: Download AVideo on Ubuntu 20.04 Server

Log into your Ubuntu 20.04 server via SSH. Then go to the web root directory.

cd /var/www/

Clone the AVideo streamer repository from Github.

sudo apt install git
sudo git clone https://github.com/WWBN/AVideo.git

Then go into the directory.

cd AVideo/

Clone the AVideo encoder repository from Github.

sudo git clone https://github.com/WWBN/AVideo-Encoder.git

It will be saved as AVideo-Encoder. We rename it to upload, so users can have a better idea of what this URL is for when uploading videos.

sudo mv AVideo-Encoder upload

Next, we need to make www-data (the web server user) as the owner of the web root.

sudo chown www-data:www-data /var/www/AVideo/ -R

Step 2: Install Dependencies

AVideo uses FFmpeg to encode videos. We can easily install FFmpeg from the default Ubuntu repository.

sudo apt install ffmpeg

To read and write meta information in multimedia files, we need to install the libimage-exiftool-perl package.

sudo apt install libimage-exiftool-perl

You also need to install some common PHP extensions.

sudo apt install php7.4-cli php7.4-common php7.4-json php7.4-opcache php7.4-readline php7.4-curl php7.4-gd php7.4-xml

To fetch videos from other sites, we need to install YouTube-DL. Though it’s included in the Ubuntu repository, but it’s outdated. We will install YouTube-DL from the Python Package Index, which always contains the latest version of YouTube-DL.

sudo apt install python3-pip
sudo -H pip3 install youtube-dl

It’s very important that you use the latest version, or you might not be able to download videos from other sites. We can create a Cron job to automatically check and install the latest version.

sudo crontab -e

Add the following line at the end of the Crontab file to try upgrading YouTube-DL daily.

@daily sudo -H pip3 install --upgrade youtube-dl > /dev/null

Step 3: Create Database and User in MariaDB

Log into MariaDB database server with the following command. Since MariaDB is now using unix_socket plugin to authentication user login, there’s no need to enter MariaDB root password. We just need to prefix the mysql command with sudo.

sudo mysql

Then create a database for AVideo. This tutorial names the database AVideo. You can use whatever name you like.

create database AVideo;

Create the database user. Again, you can use your preferred name for this user. Replace your-password with your preferred password.

create user AVideo@localhost identified by 'your-password';

Grant this user all privileges on the AVideo database.

grant all privileges on AVideo.* to AVideo@localhost;

We also need to create a separate database for the encoder.

create database AVideoEncoder;

Create a user for this database.

create user AVideoEncoder@localhost identified by 'your-password';

Grant privileges.

grant all privileges on AVideoEncoder.* to AVideoEncoder@localhost;

Flush the privileges table and exit.

flush privileges;

exit;

Step 4: Setting Up Web Server

We can use Apache or Nginx web server.

Apache

If you prefer Apache, create a virtual host file for AVideo with a command-line text editor like Nano.

sudo nano /etc/apache2/sites-available/avideo.conf

Put the following text into the file. Replace the red-colored text with your actual data. I use a subdomain in this tutorial. You can use your main domain name if you prefer. Don’t forget to create DNS A record for the domain name in your DNS record manager. Also, note that the document root directory is case-sensitive and you should not add a forward slash at the end.

<VirtualHost *:80>
    ServerName tube.yourdomain.com
    DocumentRoot /var/www/AVideo

    <Directory /var/www/AVideo>
       DirectoryIndex index.php
       Options +FollowSymLinks
       AllowOverride All
       Require all granted
    </Directory>

    ErrorLog ${APACHE_LOG_DIR}/avideo.error.log
    CustomLog ${APACHE_LOG_DIR}/avideo.access.log combined

</VirtualHost>

Save and close the file. Then enable this virtual host.

sudo a2ensite avideo.conf

We need to enable the rewrite module.

sudo a2enmod rewrite

Restart Apache for the changes to take effect.

sudo systemctl restart apache2

Now visit tube.yourdomain.com and you will be redirected to the setup wizard page (tube.yourdomain.com/install/index.php). If you see the default Apache page instead of the setup wizard, then you need to disable the default virtual host.

sudo a2dissite 000-default.conf

And restart Apache.

Before entering any information in the setup wizard, we need to enable HTTPS.

Nginx

If you prefer Nginx, create a avideo.conf file in /etc/nginx/conf.d/ directory.

sudo nano /etc/nginx/conf.d/avideo.conf

Put the following text into the file. Replace the red-colored text with your actual data. I use a subdomain in this tutorial. You can use your main domain name if you prefer. Don’t forget to create DNS A record for the domain name in your DNS record manager. Also note that the document root directory is case-sensitive.

server {
    listen      80;
    server_name tube.yourdomain.com;

    root /var/www/AVideo;
    index index.php index.html index.htm;
    charset utf-8;
    client_max_body_size 2G;

    access_log  /var/log/nginx/avideo.access.log;
    error_log   /var/log/nginx/avideo.error.log;

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

    # translating Apache rewrite rules in the .htaccess file to Nginx rewrite rules
    location / {
        rewrite ^/$ /view/ last;
    }
    location /bootstrap {
        rewrite ^/bootstrap/(.+)$ /view/bootstrap/$1 last;
    }
    location /js {
        rewrite ^/js/(.+)$ /view/js/$1 last;
    }
    location /css {
        rewrite ^/css/(.+)$ /view/css/$1 last;
    }
    location /img {
        rewrite ^/img/(.+)$ /view/img/$1 last;
    }
    location /page {
        rewrite ^/page/([0-9]+)/?$ /view/?page=$1 last;
    }
    location /videoOnly {
        rewrite ^/videoOnly/?$ /view/?type=video last;
    }
    location /audioOnly {
        rewrite ^/audioOnly/?$ /view/?type=audio last;
    }
    location = /download {
        rewrite ^(.*)$ /view/downloadExternalVideo.php last;
    }
    location = /downloadNow {
        rewrite ^(.*)$ /objects/downloadVideo.php last;
    }
    location = /getDownloadProgress {
        rewrite ^(.*)$ /objects/downloadVideoProgress.php last;
    }
    location = /about {
        rewrite ^(.*)$ /view/about.php last;
    }
    location = /contact {
        rewrite ^(.*)$ /view/contact.php last;
    }
    location = /sendEmail {
        rewrite ^(.*)$ /objects/sendEmail.json.php last;
    }
    location = /captcha {
        rewrite ^(.*)$ /objects/getCaptcha.php last;
    }
    location /monitor {
        rewrite ^/monitor/(.+)$ /objects/ServerMonitor/$1 last;
    }
    location /cat {
        rewrite ^/cat/([A-Za-z0-9-]+)/?$ /view/?catName=$1 last;
    }
    location /video {
        rewrite ^/video/([A-Za-z0-9-_.]+)/?$ /view/?videoName=$1 last;
    }
    location /videoEmbeded {
        rewrite ^/videoEmbeded/([A-Za-z0-9-_.]+)/?$ /view/videoEmbeded.php?videoName=$1 last;
    }
    location = /upload {
        rewrite ^(.*)$ /view/mini-upload-form/ last;
    }
    location = /fileUpload {
        rewrite ^(.*)$ /view/mini-upload-form/upload.php last;
    }
    location /uploadStatu {
        rewrite ^/uploadStatus /view/mini-upload-form/videoConversionStatus.php last;
    }
    location = /user {
        rewrite ^(.*)$ /view/user.php last;
    }
    location = /users {
        rewrite ^(.*)$ /view/managerUsers.php last;
    }
    location = /users.json {
        rewrite ^(.*)$ /objects/users.json.php last;
    }
    location = /updateUser {
        rewrite ^(.*)$ /objects/userUpdate.json.php last;
    }
    location = /savePhoto {
        rewrite ^(.*)$ /objects/userSavePhoto.php last;
    }
    location = /addNewUser {
        rewrite ^(.*)$ /objects/userAddNew.json.php last;
    }
    location = /deleteUser {
        rewrite ^(.*)$ /objects/userDelete.json.php last;
    }
    location = /recoverPass {
        rewrite ^(.*)$ /objects/userRecoverPass.php last;
    }
    location = /saveRecoverPassword {
        rewrite ^(.*)$ /objects/userRecoverPassSave.json.php last;
    }
    location = /signUp {
        rewrite ^(.*)$ /view/signUp.php last;
    }
    location = /createUser {
        rewrite ^(.*)$ /objects/userCreate.json.php last;
    }
    location = /usersGroups {
        rewrite ^(.*)$ /view/managerUsersGroups.php last;
    }
    location = /usersGroups.json {
        rewrite ^(.*)$ /objects/usersGroups.json.php last;
    }
    location = /addNewUserGroups {
        rewrite ^(.*)$ /objects/userGroupsAddNew.json.php last;
    }
    location = /deleteUserGroups {
        rewrite ^(.*)$ /objects/userGroupsDelete.json.php last;
    }
    location = /ads {
        rewrite ^(.*)$ /view/managerAds.php last;
    }
    location = /addNewAd {
        rewrite ^(.*)$ /objects/video_adsAddNew.json.php last;
    }
    location = /ads.json {
        rewrite ^(.*)$ /objects/video_ads.json.php last;
    }
    location = /deleteVideoAd {
        rewrite ^(.*)$ /objects/video_adDelete.json.php last;
    }
    location /adClickLo {
        rewrite ^/adClickLog /objects/video_adClickLog.php last;
    }
    location = /categories {
        rewrite ^(.*)$ /view/managerCategories.php last;
    }
    location = /categories.json {
        rewrite ^(.*)$ /objects/categories.json.php last;
    }
    location = /addNewCategory {
        rewrite ^(.*)$ /objects/categoryAddNew.json.php last;
    }
    location = /deleteCategory {
        rewrite ^(.*)$ /objects/categoryDelete.json.php last;
    }
    location = /orphanFiles {
        rewrite ^(.*)$ /view/orphanFiles.php last;
    }
    location = /mvideos {
         rewrite ^(.*)$ /view/managerVideos.php last;
    }
    location = /videos.json {
        rewrite ^(.*)$ /objects/videos.json.php last;
    }
    location = /deleteVideo {
        rewrite ^(.*)$ /objects/videoDelete.json.php last;
    }
    location = /addNewVideo {
        rewrite ^(.*)$ /objects/videoAddNew.json.php last;
    }
    location = /refreshVideo {
        rewrite ^(.*)$ /objects/videoRefresh.json.php last;
    }
    location = /setStatusVideo {
        rewrite ^(.*)$ /objects/videoStatus.json.php last;
    }
    location = /reencodeVideo {
        rewrite ^(.*)$ /objects/videoReencode.json.php last;
    }
    location = /addViewCountVideo {
        rewrite ^(.*)$ /objects/videoAddViewCount.json.php last;
    }
    location = /saveComment {
        rewrite ^(.*)$ /objects/commentAddNew.json.php last;
    }
    location /comments {
        rewrite ^/comments.json/([0-9]+)$ /objects/comments.json.php?video_id=$1 last;
    }
    location = /login {
        rewrite ^(.*)$ /objects/login.json.php last;
    }
    location = /logoff {
        rewrite ^(.*)$ /objects/logoff.php last;
    }
    location = /like {
        rewrite ^(.*)$ /objects/like.json.php?like=1 last;
    }
    location = /dislike {
        rewrite ^(.*)$ /objects/like.json.php?like=-1 last;
    }
    location /update {
        rewrite ^/update/?$ /update/update.php last;
    }
    location = /siteConfigurations {
        rewrite ^(.*)$ /view/configurations.php last;
    }
    location = /updateConfig {
        rewrite ^(.*)$ /objects/configurationUpdate.json.php last;
    }
    location = /charts {
        rewrite ^(.*)$ /view/charts.php last;
    }

    location = /upload/index.php {
       rewrite ^(.*)$ /upload/view/index.php last;
    }

    location = /upload/isAdmin {
      rewrite ^(.*)$ /upload/view/isAdmin.php last;
   }

   location = /upload/removeStreamer {
     rewrite ^(.*)$ /upload/view/removeStreamer.php last;
   }

  location = /upload/priority {
     rewrite ^(.*)$ /upload/view/priority.php last;
  }

  location = /upload/status {
     rewrite ^(.*)$ /upload/view/status.php last;
  }

  location = /upload/serverStatus {
    rewrite ^(.*)$ /upload/view/status.php?serverStatus=1 last;
  }

  location = /upload/upload {
    rewrite ^(.*)$ /upload/view/upload.php last;
  }

  location = /upload/listFiles.json {
   rewrite ^(.*)$ /upload/view/listFiles.json.php last;
  }

  location = /upload/deleteQueue {
    rewrite ^(.*)$ /upload/view/deleteQueue.php last;
  }

  location = /upload/saveConfig {
    rewrite ^(.*)$ /upload/view/saveConfig.php last;
  }

  location = /upload/youtubeDl.json {
    rewrite ^(.*)$ /upload/view/youtubeDl.json.php last;
  }

  location = /upload/send.json {
    rewrite ^(.*)$ /upload/view/send.json.php last;
  }

  location = /upload/streamers.json {
    rewrite ^(.*)$ /upload/view/streamers.json.php last;
  }

  location = /upload/queue.json {
    rewrite ^(.*)$ /upload/view/queue.json.php last;
  }

  location = /upload/queue {
    rewrite ^(.*)$ /upload/view/queue.php last;
  }

  location = /upload/login {
    rewrite ^(.*)$ /upload/objects/login.json.php last;
  }

  location = /upload/logoff {
    rewrite ^(.*)$ /upload/objects/logoff.json.php last;
  }

  location /upload/ {
    rewrite "^/getImage/([A-Za-z0-9=/]+)/([A-Za-z0-9]{3})$" /upload/objects/getImage.php?base64Url=$1&format=$2 last;
    rewrite "^/getImageMP4/([A-Za-z0-9=/]+)/([A-Za-z0-9]{3})/([0-9.]+)$" /upload/objects/getImageMP4.php?base64Url=$1&format=$2&time=$3 last;
  }

  location /upload/getSpiritsFromVideo {
    rewrite ^/getSpiritsFromVideo/([A-Za-z0-9=/]+)/([0-9]+)/([0-9]+)$ /upload/objects/getSpiritsFromVideo.php?base64Url=$1&tileWidth=$2&totalClips=$3 last;
  }

  location /upload/getLinkInfo {
    rewrite ^/getLinkInfo/([A-Za-z0-9=/]+)$ /upload/objects/getLinkInfo.json.php?base64Url=$1 last;
  }

}

Save and close the file. Then test Nginx configuration.

sudo nginx -t

If the test is successful, reload Nginx for the changes to take effect.

sudo systemctl reload nginx

Now visit tube.yourdomain.com and you will be redirected to the setup wizard page (tube.yourdomain.com/install/index.php). Before entering any information in the setup wizard, we need to enable HTTPS.

Step 5: Enabling HTTPS

To encrypt the HTTP traffic, we can enable HTTPS by installing a free TLS certificate issued from Let’s Encrypt. Run the following command to install Let’s Encrypt client (certbot) on Ubuntu 20.04 server.

sudo apt install certbot

If you use Apache, you also need to install the Certbot Apache plugin.

sudo apt install python3-certbot-apache

And run this command to obtain and install TLS certificate.

sudo certbot --apache --agree-tos --redirect --hsts --staple-ocsp --email [email protected] -d tube.yourdomain.com

If you use Nginx, install the Certbot Nginx plugin.

sudo apt install python3-certbot-nginx

Next, run the following command to obtain and install TLS certificate.

sudo certbot --nginx --agree-tos --redirect --hsts --staple-ocsp --email [email protected] -d tube.yourdomain.com

Where

  • --nginx: Use the nginx plugin.
  • --apache: Use the Apache plugin.
  • --agree-tos: Agree to terms of service.
  • --redirect: Force HTTPS by 301 redirect.
  • --hsts: Add the Strict-Transport-Security header to every HTTP response. Forcing browser to always use TLS for the domain. Defends against SSL/TLS Stripping.
  • --staple-ocsp: Enables OCSP Stapling. A valid OCSP response is stapled to the certificate that the server offers during TLS.

The certificate should now be obtained and automatically installed.

install-youphptube-on-ubuntu-20.04

Step 6: Finish Installation with the Setup Wizard

Now go to tube.yourdomain.com and the setup wizard will appear. On the left side, you can see if your server meet the requirements.

avideo-requirements

If you use Nginx, you can ignore the following message.

Your server is nginx/1.14.2, you must install Apache.

As you can see, the PHP post_max_size should be at least 100M and upload_max_filesize should be at least 100M. We need to edit the php.ini file to change the two values. If you use Apache web server, then

sudo nano /etc/php/7.4/apache2/php.ini

If you use Nginx with PHP-FPM, then you need to edit the FPM version of php.ini file.

sudo nano /etc/php/7.4/fpm/php.ini

Find the following two lines.

post_max_size = 8M
upload_max_filesize = 2M

Change the values according to the video file size you are going to upload. For example, if you allow uploading 1G video file, then

post_max_size = 1024M
upload_max_filesize = 1024M

Save and close the file. Restart Apache for the changes to take effect.

sudo systemctl restart apache2

If you use Nginx with PHP-FPM, then restart PHP-FPM.

sudo systemctl restart php7.4-fpm

Now refresh the AVideo install wizard page. Your server should pass all requirements. Now on the right side, you can enter a title your video site, and set a system admin password. Enter the AVideo database name, user and password your created earlier. (Note: You should use the main database, not the encoder database. Also be aware of case-sensitive.)

avideo-create-database-and-tables

 

Click the Install now button and AVideo should be installed successfully.

avideo-install-directory

Now we need to remove the /var/www/AVideo/install/ directory.

sudo rm /var/www/AVideo/install/ -r

Click the Go to the main page button and you will see the AVideo main page.

avideo main page

You can click the drop-down menu on the left and login as the admin user and with the password you set just a few moments ago.

youphptube admin signin

Step 7: Set Up the Encoder

Go to https://tube.yourdomain.com/upload/. You will be redirected to the Encoder setup wizard. If you are not automatically redirected, then you can manually enter the setup wizard URL.

https://tube.yourdomain.com/upload/install/index.php/

The left hand side will show you if your server meet the requirements of AVideo Encoder.

avideo-encoder-requirements

If you use Nginx, you can ignore the following message.

Your server is nginx/1.14.2, you must install Apache.

As you can see the PHP max_execution_time should be at least 7200 and PHP memory_limit should be at least 512M. We need to edit the php.ini file to change the two values. If you use Apache web server, then

sudo nano /etc/php/7.4/apache2/php.ini

If you use Nginx with PHP-FPM, then you need to edit the FPM version of php.ini file.

sudo nano /etc/php/7.4/fpm/php.ini

Find the following two lines.

max_execution_time = 30
memory_limit = 128M

Change the values.

max_execution_time = 7200
memory_limit = 512M

Note that if later video encoding stops half way through, you need to increase the max_execution_time, or upgrade your CPU.

Save and close the file. Restart Apache for the changes to take effect.

sudo systemctl restart apache2

If you use Nginx with PHP-FPM, then restart PHP-FPM.

sudo systemctl restart php7.4-fpm

Now refresh the AVideo Encoder install wizard page. Your server should pass all requirements. Now on the right side, you need to enter the AVideoEncoder database name, user and password your created earlier. Be aware of case-sensitive and enter the streamer site’s admin password.

avideo-encoder-setup-wizard-database

 

Click the Install Now button and AVideo Encoder will be installed.

install-avideo-encoder-ubuntu-20.04

Remove the install directory.

sudo rm /var/www/AVideo/upload/install/ -r

And go to the main page.

youphptube encoder admin signin

Step 8 : Change the Encoder URL

By default, AVideo uses the public encoder for uploading videos. To use your own encoder, sign in as admin in AVideo (not AVideo Encoder) and go to the admin panel from the left sidebar.

avideo-admin-panel

Go to settings -> site settings -> advanced configuration. Change the Encoder URL to https://tube.yourdomain.com/upload/. Save the settings, clear the cache directory and generate a new sitemap.

avideo-private-encoder-url

Now log out and log back in. If you click the encode video and audio button on the upper-right corner, you will be taken to your own encoder to upload videos. It should be noted that the encoding speed depends on your server’s CPU power. It doesn’t require much RAM because the encoder will copy the video to a temporary file in the upload directory (/var/www/AVideo/upload/videos).

Step 9: Configure SMTP

To send out emails (such as account registration, password reset, etc), you need to configure an SMTP server. If you would like to use your own mail server to send emails to clients, please check out the following article to set up your own mail server. Note that I highly recommend running iRedMail mail server on a fresh clean OS. Installing iRedMail on an OS that has other web applications can fail, and likely break existing applications.

If you would like to use an SMTP relay service, I recommend Mailjet. You can follow the tutorial below to set up SMTP relay on your AVideo server.

You can test email sending by going to the admin panel -> Setttings -> Site Settings -> Advanced Configuration, you can find SMTP configuration. Use the following settings.

  • Enable SMTP.
  • Enable SMTP Auth.
  • Use tls in SMTP Secure.
  • Use 587 as the SMTP port.
  • Enter your mail server’s hostname.
  • Enter an SMTP username and password.

Click the Save button to save the settings, then click Test Email to see if it’s working.

avideo email configuration

 

Enable TCP BBR

For a video streaming server, it’s recommended to enable the TCP BBR congestion control algorithm in the Linux kernel by following the instructions in the article below.

Mobile Apps

You can download the free android app or iOS app by doing a search for AVideo on Google Play Store or YPT Mobile in Apple Store. White-label mobile app require a paid license.

Troubleshooting

If your AVideo main page failed to load some CSS and JavaScript resources,

youphptube failed to load resources

It’s likely that you have added extra forward slash in the Apache or Nginx virtual host file for the web root directory. Instead of using

DocumentRoot /var/www/AVideo/

You should use

DocumentRoot /var/www/AVideo

If the main website isn’t working properly, you can check the log file at /var/www/AVideo/videos/youphptube.log. If your encoder isn’t working properly, you can check the log file at /var/www/AVideo/upload/videos/youphptube.log.

Other Tidbits

When encoding videos, you can choose resolutions (low, SD, HD). If you use AVideo as a personal video streaming site, I recommend choosing HD resolution only to reduce encoding time and save disk space. If you have already encoded videos to all 3 resolutions, you can go to the AVideo video directory (/var/www/AVideo/videos) and delete low resolution and SD resolution videos.

cd /var/www/AVideo/videos/
sudo rm *Low.mp4
sudo rm *SD.mp4

How To Download All Videos From Your Video Site

You can use the youtube-dl command line utility to download all videos. First, you need to go to AVideo dashboard, then go to the video list page and scroll down to the bottom, click the download your videos list (permalink .txt file) button. You will see a list of URL for all the videos.

Next, open up a terminal and create a txt file with a text editor, copy the URLs from the web page and paste them into the file. Then you can run the following command to download the videos. Replace video-list.txt with the your own file name.

youtube-dl -a video-list.txt

Wrapping Up

I hope this tutorial helped you install AVideo on Ubuntu 20.04 server. As always, if you found this post useful, then subscribe to our free newsletter to get more tips and tricks. Take care 🙂

Rate this tutorial
[Total: 3 Average: 5]

25 Responses to “How to Install AVideo/YouPHPTube on Ubuntu 20.04 Server

  • adrianthuo
    4 years ago

    hi i am using google cloud service how do i set up ” Don’t forget to set DNS A record for the domain name in your DNS record manager”

  • After going through this great tutorial twice (both on fresh instances of Ubuntu 20.04), I can not sign in to the streamer sight.
    The /var/www/AVideo/upload/videos/avideo.log entries that appear when I attempt to sign in are…

    [31-Oct-2020 00:43:07 America/Chicago] https://chaosvids.com/ == https://chaosvids.com/
    [31-Oct-2020 00:43:07 America/Chicago] login.json: Login::run
    [31-Oct-2020 00:43:07 America/Chicago] Login::run (admin, ***, https://chaosvids.com/, false)
    [31-Oct-2020 00:43:07 America/Chicago] Get Login fail, try again
    [31-Oct-2020 00:43:07 America/Chicago] Login::run response: ()
    [31-Oct-2020 00:43:07 America/Chicago] Login::run Error on Login context
    [31-Oct-2020 00:43:07 America/Chicago] https://***.com/login?user=admin&pass=***&encodedPass=false
    [31-Oct-2020 00:43:07 America/Chicago] 
    [31-Oct-2020 00:43:07 America/Chicago] Login:: done session_id = glv4pn8hegfh2m9msvkog9jck8 session_login {"streamer":false,"streamers_id":0,"isLogged":false,"isAdmin":false,"canUpload":false,"canComment":false,"categories":[],"userGroups":[],"aVideoURL":"https:\/\/***.com\/login?user=admin&pass=***&encodedPass=false","result":"","PHPSESSID":"glv4pn8hegfh2m9msvkog9jck8"}
    

    When I attempt to sign in, I get “SORRY! We could not find your streamer sight!”

    Any help would be greatly appreciated.

    • Please *** my URL, I missed a few at the top.

    • I have already altered the php.ini with the “allow_url_fopen = On” and “allow_url_include = On” as well.

      • Fixed this by changing the hosts file (etc/hosts). Instead of 127.0.0.1 localhost, change it to 127.0.0.1 your.url.com

  • When setting up Certbot I set it to redirect (http to https), and it prevented live streams from showing up on the main page. I had to comment out the redirect (RewriteRule) in the virtual host of the config (/etc/apache2/sites-enabled/avideo.conf). Hopefully this will help people fix this in less than the two days it took me. 🙂

  • Trying to get live streaming working. It’s non-intuitive, and no real directions anywhere…

  • Eugeniusz
    3 years ago

    If your Android app is not working and you are using Nginx, there could potentially be two reasons.
    First, please add to virtualhost configuation this:

    location = /status {
    rewrite ^(.*)$ /objects/status.json.php last;
    }

    Second, please use the correct andoid app – there are exactly two apps, one is open source and one is “while labelled”. The open-source will work.

  • Eugeniusz
    3 years ago

    Well… I have definitely read that the support of Nginx is experimental, but the amount of 404 errors for urls in logs is overwhelming, The config should be updated definitely.

    Not sure if that is due to that, but when I save the video, it processes it, the CPU is going to 100% when encoding and then…. nothing happens. The video is just gone. The owner of all files and folders in /var/www is www-data:www-data, so should be no issues from this side. Maybe that’s due to missing URLs, dunno. Anyone to advise?

    • Eugeniusz
      3 years ago

      Update. Made it work.
      So, for NGINX users, what to do (example.com – your domain).

      1. /etc/nginx/sites-available/avideo.conf

      server {
      server_name tube.example.com;

      root /var/www/avideo; #I used lower-case
      index index.php index.html index.htm;

      charset utf-8;
      client_max_body_size 16G; #yes, 2G for me is too low

      access_log /var/log/nginx/tube_access.log;
      error_log /var/log/nginx/tube_error.log;

      # this is important. Please create the /var/www/avideo/404.html file with some 404 content
      error_page 404 /404.html;

      location ~ ^/(.+\.php)$ {
      fastcgi_split_path_info ^(.+\.php)(/.+)$;
      try_files $uri $uri/ =404;
      fastcgi_pass unix:/run/php/php7.4-fpm.sock;
      fastcgi_index index.php;
      fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
      include /etc/nginx/fastcgi_params;
      }
      #this file also has to be created!

      include /etc/nginx/avideo_htaccess;

      listen 443 ssl; # managed by Certbot
      ssl_certificate /etc/letsencrypt/live/tube.example.com/fullchain.pem; # managed by Certbot
      ssl_certificate_key /etc/letsencrypt/live/tube.example.com/privkey.pem; # managed by Certbot
      include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
      ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot

      }
      server {
      if ($host = tube.example.com) {
      return 301 https://$host$request_uri;
      } # managed by Certbot

      listen 80;
      server_name tube.example.com;
      return 404; # managed by Certbot
      }

      cat /etc/nginx/avideo_htaccess

      rewrite ^/videos/([^/]+)/(.*).key$ /plugin/VideoHLS/downloadProtection.php?filename=$1&key=$2;
      rewrite glyphicons-halflings-regular(.+)$ view/bootstrap/fonts/glyphicons-halflings-regular$1 last;
      rewrite ^/meet/([0-9]+)/(.+)$ /plugin/Meet/iframe.php?meet_schedule_id=$1&roomName=$2 last;
      rewrite ^/meet/([0-9]+)$ /plugin/Meet/iframe.php?meet_schedule_id=$1 last;
      rewrite ^/live/([0-9]+)/(.+)$ /plugin/Live/?live_servers_id=$1&c=$2 last;
      rewrite ^/liveLink/([0-9]+).*$ /plugin/LiveLinks/view/Live.php?link=$1 last;
      rewrite ^/liveLinkEmbed/([0-9]+).*$ /plugin/LiveLinks/view/Live.php?link=$1&embed=1 last;
      rewrite ^/index.php$ /view/index.php last;
      rewrite ^/bootstrap/(.+)$ /view/bootstrap/$1 last;
      rewrite bootstrap-select.js.map$ view/bootstrap/bootstrapSelectPicker/js/bootstrap-select.js.map$1 last;
      rewrite ^/oembed/?(.+)$ /view/oembed.php$1 last;
      rewrite ^/js/(.+)$ /view/js/$1 last;
      rewrite ^/css/(.+)$ /view/css/$1 last;
      rewrite ^/img/(.+)$ /view/img/$1 last;
      rewrite ^/i/(.+)$ /view/iframe.php?type=$1 last;
      rewrite ^/videos/fonts/(.+)$ /view/bootstrap/fonts/$1 last;
      rewrite ^/page/([0-9]+)/?$ /view/?page=$1;
      rewrite ^/videoOnly/?$ /view/?type=video last;
      rewrite ^/audioOnly/?$ /view/?type=audio last;
      rewrite ^/download$ /view/downloadExternalVideo.php last;
      rewrite ^/info$ /view/info.php last;
      rewrite ^/version$ /view/info.php?version=1 last;
      rewrite ^/downloadNow$ /objects/downloadVideo.php last;
      rewrite ^/getDownloadProgress$ /objects/downloadVideoProgress.php last;
      rewrite ^/status$ /objects/status.json.php last;
      #rewrite ^/menu/([^!#$&'()\*\+,\/:;=?@[\]]+)/? /plugin/TopMenu/seo.php?menuSeoUrlItem=$1 last;
      rewrite ^/menu/(.*)/? /plugin/TopMenu/seo.php?menuSeoUrlItem=$1 last;
      rewrite ^/admin/plugin/(.+)$ /plugin/$1 last;
      rewrite ^/trending/?$ /view/trending.php last;
      rewrite ^/about$ /view/about.php last;
      rewrite ^/contact$ /view/contact.php last;
      rewrite ^/sendEmail$ /objects/sendEmail.json.php last;
      rewrite ^/captcha$ /objects/getCaptcha.php last;
      rewrite ^/monitor/(.+)$ /objects/ServerMonitor/$1 last;
      rewrite ^/videosList$ /view/videosList.php last;
      rewrite ^/videosList/video/(.*)/page/([0-9]+)/?$ /view/videosList.php?videoName=$1&page=$2;
      rewrite ^/videosList/cat/(.*)/video/(.*)/page/([0-9]+)/?$ /view/videosList.php?catName=$1&videoName=$2&page=$3;
      rewrite ^/cat/(.*)/?$ /view/?catName=$1 last;
      rewrite ^/cat/(.*)/page/([0-9]+)/?$ /view/?catName=$1&page=$2 last;
      rewrite ^/tag/([0-9-]+)(.*)?$ /view/?tags_id=$1 last;
      rewrite ^/video/(.*)/?$ /view/?videoName=$1;
      rewrite ^/video/(.*)/page/([0-9]+)/??$ /view/?videoName=$1&page=$2;
      rewrite ^/v/([0-9]+)/?$ /view/?v=$1;
      rewrite ^/v/([0-9]+)/page/([0-9]+)/??$ /view/?v=$1&page=$2;
      rewrite ^/video/([0-9]+)/(.*)/?$ /view/?v=$1;
      rewrite ^/video/([0-9]+)/(.*)/page/([0-9]+)/??$ /view/?v=$1&page=$3;
      rewrite ^/evideo/([a-zA-z0-9=]+)/?$ /view/?evideo=$1;
      rewrite ^/cat/(.*)/video/(.*)/?$ /view/?catName=$1&videoName=$2;
      rewrite ^/cat/(.*)/video/(.*)/page/([0-9]+)/?$ /view/?catName=$1&videoName=$2&page=$3;
      rewrite ^/videoEmbeded/([0-9]+)/? /view/videoEmbeded.php?v=$1;
      rewrite ^/videoEmbeded/(.*)/?$ /view/videoEmbeded.php?videoName=$1;
      rewrite ^/cat/(.*)/videoEmbeded/(.*)/?$ /view/videoEmbeded.php?catName=$1&videoName=$2;
      rewrite ^/videoEmbed/([0-9]+)/? /view/videoEmbeded.php?v=$1;
      rewrite ^/videoEmbed/(.*)/?$ /view/videoEmbeded.php?videoName=$1;
      rewrite ^/vEmbed/([0-9]+)/?$ /view/videoEmbeded.php?v=$1;
      rewrite ^/videoEmbed/([0-9]+)/(.*)/?$ /view/videoEmbeded.php?v=$1;
      rewrite ^/evideoEmbed/([a-zA-z0-9=]+)/?$ /view/videoEmbeded.php?evideo=$1;
      rewrite ^/plugin/(.*)/(.*)?$ /plugin/$1/$2 last;
      rewrite ^/upload$ /view/mini-upload-form/ last;
      rewrite ^/fileUpload$ /view/mini-upload-form/upload.php last;
      rewrite ^/uploadPoster/([0-9]+)/(jpg|gif)$ /objects/uploadPoster.php?video_id=$1&type=$2 last;
      rewrite ^/article/(.*)/?$ /view/?videoName=$1;
      rewrite ^/article/(.*)/page/([0-9]+)/??$ /view/?videoName=$1&page=$2;
      rewrite ^/article/([0-9]+)/(.*)/?$ /view/?v=$1;
      rewrite ^/article/([0-9]+)/(.*)/page/([0-9]+)/??$ /view/?v=$1&page=$3;
      rewrite ^/articleEmbed/([0-9]+)/? /view/videoEmbeded.php?v=$1;
      rewrite ^/articleEmbed/(.*)/?$ /view/videoEmbeded.php?videoName=$1;
      rewrite ^/cat/(.*)/articleEmbed/(.*)/?$ /view/videoEmbeded.php?catName=$1&videoName=$2;
      rewrite ^/articleEmbed/([0-9]+)/? /view/videoEmbeded.php?v=$1;
      rewrite ^/articleEmbed/(.*)/?$ /view/videoEmbeded.php?videoName=$1;
      rewrite ^/articleEmbed/([0-9]+)/(.*)/?$ /view/videoEmbeded.php?v=$1;
      rewrite ^/user$ /view/user.php last;
      rewrite ^/users$ /view/managerUsers.php last;
      rewrite ^/users.json$ /objects/users.json.php last;
      rewrite ^/updateUser$ /objects/userUpdate.json.php last;
      rewrite ^/savePhoto$ /objects/userSavePhoto.php last;
      rewrite ^/saveBackground$ /objects/userSaveBackground.php last;
      rewrite ^/addNewUser$ /objects/userAddNew.json.php last;
      rewrite ^/deleteUser$ /objects/userDelete.json.php last;
      rewrite ^/recoverPass$ /objects/userRecoverPass.php last;
      rewrite ^/saveRecoverPassword$ /objects/userRecoverPassSave.json.php last;
      rewrite ^/signUp$ /view/signUp.php last;
      rewrite ^/createUser$ /objects/userCreate.json.php last;
      rewrite ^/usersGroups$ /view/managerUsersGroups.php last;
      rewrite ^/usersGroups.json$ /objects/usersGroups.json.php last;
      rewrite ^/addNewUserGroups$ /objects/userGroupsAddNew.json.php last;
      rewrite ^/deleteUserGroups$ /objects/userGroupsDelete.json.php last;
      rewrite ^/categories$ /view/managerCategories.php last;
      rewrite ^/categories.json$ /objects/categories.json.php last;
      rewrite ^/addNewCategory$ /objects/categoryAddNew.json.php last;
      rewrite ^/deleteCategory$ /objects/categoryDelete.json.php last;
      rewrite ^/plugins$ /view/managerPlugins.php last;
      rewrite ^/plugins.json$ /objects/plugins.json.php last;
      rewrite ^/pluginsAvailable.json$ /objects/pluginsAvailable.json.php last;
      rewrite ^/pluginImport.json$ /objects/pluginImport.json.php last;
      rewrite ^/switchPlugin$ /objects/pluginSwitch.json.php last;
      rewrite ^/addDataObjectPlugin.json$ /objects/pluginAddDataObject.json.php last;
      rewrite ^/runDBScriptPlugin.json$ /objects/pluginRunDatabaseScript.json.php last;
      rewrite ^/epg.xml$ /plugin/PlayLists/epg.xml.php last;
      rewrite ^/epg.json$ /plugin/PlayLists/epg.json.php last;
      rewrite ^/epg.html$ /plugin/PlayLists/epg.html.php last;
      rewrite ^/epg$ /plugin/PlayLists/epg.php last;
      rewrite ^/tv$ /plugin/PlayLists/tv.php last;
      rewrite ^/iptv$ /plugin/PlayLists/iptv.php last;
      rewrite ^/iptv/([^/]+)/?$ /plugin/PlayLists/iptv.php?channelName=$1 last;
      rewrite ^/playLists.json$ /objects/playlists.json.php last;
      rewrite ^/playListsVideos.json$ /objects/playlistsVideos.json.php last;
      rewrite ^/playListsFromUser.json/([0-9]+)/?$ /objects/playlistsFromUser.json.php?users_id=$1 last;
      rewrite ^/addNewPlayList$ /objects/playlistAddNew.json.php last;
      rewrite ^/playListAddVideo.json$ /objects/playListAddVideo.json.php last;
      rewrite ^/playlist/([0-9]+)/([0-9]+)/?$ /view/?playlist_id=$1&playlist_index=$2 last;
      rewrite ^/playlist/([0-9]+)/?$ /view/?playlist_id=$1 last;
      rewrite ^/removeVideoFromPlaylist/?$ /objects/playlistRemoveVideo.php last;
      rewrite ^/removePlaylist/?$ /objects/playlistRemove.php last;
      rewrite ^/renamePlaylist/?$ /objects/playlistRename.php last;
      rewrite ^/sortPlaylist/?$ /objects/playlistSort.php last;
      rewrite ^/mrss/?$ /feed/index.php?mrss=1;
      rewrite ^/roku.json$ /feed/index.php?roku=1;
      rewrite ^/channel/([^/]+)/roku.json$ /feed/index.php?channelName=$1&roku=1;
      rewrite ^/channel/([^/]+)/feed/?$ /feed/index.php?channelName=$1;
      rewrite ^/channel/([^/]+)/rss/?$ /feed/index.php?channelName=$1;
      rewrite ^/channel/([^/]+)/mrss/?$ /feed/index.php?channelName=$1&mrss=1;
      rewrite ^/channel/([^/]+) /view/channel.php?channelName=$1;
      rewrite ^/channel/?$ /view/channel.php;
      rewrite ^/channels/?$ /view/channels.php last;
      rewrite ^/programs.json$ /objects/playlists.json.php;
      rewrite ^/program/([0-9]+)/([0-9]+)(/.*)?$ /view/?playlist_id=$1&playlist_index=$2;
      rewrite ^/program/([0-9]+)(/.*)?$ /view/?playlist_id=$1;
      rewrite ^/viewProgram/([0-9]+).*?$ /view/channelProgram.php?program_id=$1;
      rewrite ^/favorite/?$ /view/?playlist_id=favorite;
      rewrite ^/watch-later/?$ /view/?playlist_id=watch-later;
      rewrite ^/orphanFiles$ /view/orphanFiles.php last;
      rewrite ^/mvideos$ /view/managerVideos.php last;
      rewrite ^/videos.json$ /objects/videos.json.php last;
      rewrite ^/videosAndroid.json$ /objects/videosAndroid.json.php last;
      rewrite ^/videoAndroid.json$ /objects/videoAndroid.json.php last;
      rewrite ^/deleteVideo$ /objects/videoDelete.json.php last;
      rewrite ^/addNewVideo$ /objects/videoAddNew.json.php last;
      rewrite ^/refreshVideo$ /objects/videoRefresh.json.php last;
      rewrite ^/setStatusVideo$ /objects/videoStatus.json.php last;
      rewrite ^/setCategoryVideo$ /objects/videoCategory.json.php last;
      rewrite ^/rotateVideo$ /objects/videoRotate.json.php last;
      rewrite ^/subscribes$ /view/managerSubscribes.php last;
      rewrite ^/subscribes.json$ /objects/subscribes.json.php last;
      rewrite ^/subscribe.json$ /objects/subscribe.json.php last;
      rewrite ^/notifySubscribers.json$ /objects/notifySubscribers.json.php last;
      rewrite ^/aVideoQueueEncoder.json$ /objects/aVideoQueueEncoder.json.php last;
      rewrite ^/aVideoEncoder.json$ /objects/aVideoEncoder.json.php last;
      rewrite ^/aVideoEncoderChunk.json$ /objects/aVideoEncoderChunk.json.php last;
      rewrite ^/comments$ /view/managerComments.php last;
      rewrite ^/saveComment$ /objects/commentAddNew.json.php last;
      rewrite ^/comments.json/([0-9]+)$ /objects/comments.json.php?video_id=$1 last;
      rewrite ^/login$ /objects/login.json.php last;
      rewrite ^/logoff$ /objects/logoff.php last;
      rewrite ^/like$ /objects/like.json.php?like=1;
      rewrite ^/dislike$ /objects/like.json.php?like=-1;
      rewrite ^/update/?$ /view/update.php last;
      rewrite ^/siteConfigurations$ /view/configurations.php last;
      rewrite ^/updateConfig$ /objects/configurationUpdate.json.php last;
      rewrite ^/charts$ /view/charts.php last;
      rewrite ^/help$ /view/help.php last;
      rewrite ^/youtubeUpload$ /objects/youtubeUpload.json.php last;
      rewrite ^/googleAdView$ /view/googleAdView.php last;
      rewrite ^/notifications.json$ /objects/notifications.json.php last;
      rewrite ^/sitemap.xml$ /view/sitemap.xml.php last;
      rewrite ^/robots.txt$ /view/robots.txt.php last;
      rewrite ^/videos/(.*)/index.m3u8$ /view/hls.php?videoDirectory=$1 last;
      rewrite ^/vast.xml/?([0-9]+)?$ /plugin/AD_Server/VAST.php?campaign_has_videos_id=$1 last;
      rewrite ^/videos/((.*)(\.(mp4|webm|m3u8|mp3|ogg)))$ /view/xsendfile.php?file=$1;

      # translating Apache rewrite rules in the .htaccess file to Nginx rewrite rules
      location / {
      rewrite ^/$ /view/ last;
      }
      location /bootstrap {
      rewrite ^/bootstrap/(.+)$ /view/bootstrap/$1 last;
      }
      location /js {
      rewrite ^/js/(.+)$ /view/js/$1 last;
      }
      location /css {
      rewrite ^/css/(.+)$ /view/css/$1 last;
      }
      location /img {
      rewrite ^/img/(.+)$ /view/img/$1 last;
      }
      location /page {
      rewrite ^/page/([0-9]+)/?$ /view/?page=$1 last;
      }
      location /videoOnly {
      rewrite ^/videoOnly/?$ /view/?type=video last;
      }
      location /audioOnly {
      rewrite ^/audioOnly/?$ /view/?type=audio last;
      }
      location = /download {
      rewrite ^(.*)$ /view/downloadExternalVideo.php last;
      }
      location = /downloadNow {
      rewrite ^(.*)$ /objects/downloadVideo.php last;
      }
      location = /getDownloadProgress {
      rewrite ^(.*)$ /objects/downloadVideoProgress.php last;
      }
      location = /about {
      rewrite ^(.*)$ /view/about.php last;
      }
      location = /contact {
      rewrite ^(.*)$ /view/contact.php last;
      }
      location = /sendEmail {
      rewrite ^(.*)$ /objects/sendEmail.json.php last;
      }
      location = /captcha {
      rewrite ^(.*)$ /objects/getCaptcha.php last;
      }
      location /monitor {
      rewrite ^/monitor/(.+)$ /objects/ServerMonitor/$1 last;
      }
      location /cat {
      rewrite ^/cat/([A-Za-z0-9-]+)/?$ /view/?catName=$1 last;
      }
      location /video {
      rewrite ^/video/([A-Za-z0-9-_.]+)/?$ /view/?videoName=$1 last;
      }
      location /videoEmbeded {
      rewrite ^/videoEmbeded/([A-Za-z0-9-_.]+)/?$ /view/videoEmbeded.php?videoName=$1 last;
      }
      location = /upload {
      rewrite ^(.*)$ /view/mini-upload-form/ last;
      }
      location = /fileUpload {
      rewrite ^(.*)$ /view/mini-upload-form/upload.php last;
      }
      location /uploadStatu {
      rewrite ^/uploadStatus /view/mini-upload-form/videoConversionStatus.php last;
      }
      location = /user {
      rewrite ^(.*)$ /view/user.php last;
      }
      location = /users {
      rewrite ^(.*)$ /view/managerUsers.php last;
      }
      location = /users.json {
      rewrite ^(.*)$ /objects/users.json.php last;
      }
      location = /updateUser {
      rewrite ^(.*)$ /objects/userUpdate.json.php last;
      }
      location = /savePhoto {
      rewrite ^(.*)$ /objects/userSavePhoto.php last;
      }
      location = /addNewUser {
      rewrite ^(.*)$ /objects/userAddNew.json.php last;
      }
      location = /deleteUser {
      rewrite ^(.*)$ /objects/userDelete.json.php last;
      }
      location = /recoverPass {
      rewrite ^(.*)$ /objects/userRecoverPass.php last;
      }
      location = /saveRecoverPassword {
      rewrite ^(.*)$ /objects/userRecoverPassSave.json.php last;
      }
      location = /signUp {
      rewrite ^(.*)$ /view/signUp.php last;
      }
      location = /createUser {
      rewrite ^(.*)$ /objects/userCreate.json.php last;
      }
      location = /usersGroups {
      rewrite ^(.*)$ /view/managerUsersGroups.php last;
      }
      location = /usersGroups.json {
      rewrite ^(.*)$ /objects/usersGroups.json.php last;
      }
      location = /addNewUserGroups {
      rewrite ^(.*)$ /objects/userGroupsAddNew.json.php last;
      }
      location = /deleteUserGroups {
      rewrite ^(.*)$ /objects/userGroupsDelete.json.php last;
      }
      location = /ads {
      rewrite ^(.*)$ /view/managerAds.php last;
      }
      location = /addNewAd {
      rewrite ^(.*)$ /objects/video_adsAddNew.json.php last;
      }
      location = /ads.json {
      rewrite ^(.*)$ /objects/video_ads.json.php last;
      }
      location = /deleteVideoAd {
      rewrite ^(.*)$ /objects/video_adDelete.json.php last;
      }
      location /adClickLo {
      rewrite ^/adClickLog /objects/video_adClickLog.php last;
      }
      location = /categories {
      rewrite ^(.*)$ /view/managerCategories.php last;
      }
      location = /categories.json {
      rewrite ^(.*)$ /objects/categories.json.php last;
      }
      location = /addNewCategory {
      rewrite ^(.*)$ /objects/categoryAddNew.json.php last;
      }
      location = /deleteCategory {
      rewrite ^(.*)$ /objects/categoryDelete.json.php last;
      }
      location = /orphanFiles {
      rewrite ^(.*)$ /view/orphanFiles.php last;
      }
      location = /mvideos {
      rewrite ^(.*)$ /view/managerVideos.php last;
      }
      location = /videos.json {
      rewrite ^(.*)$ /objects/videos.json.php last;
      }
      location = /deleteVideo {
      rewrite ^(.*)$ /objects/videoDelete.json.php last;
      }
      location = /addNewVideo {
      rewrite ^(.*)$ /objects/videoAddNew.json.php last;
      }
      location = /refreshVideo {
      rewrite ^(.*)$ /objects/videoRefresh.json.php last;
      }
      location = /setStatusVideo {
      rewrite ^(.*)$ /objects/videoStatus.json.php last;
      }
      location = /reencodeVideo {
      rewrite ^(.*)$ /objects/videoReencode.json.php last;
      }
      location = /addViewCountVideo {
      rewrite ^(.*)$ /objects/videoAddViewCount.json.php last;
      }
      location = /saveComment {
      rewrite ^(.*)$ /objects/commentAddNew.json.php last;
      }
      location /comments {
      rewrite ^/comments.json/([0-9]+)$ /objects/comments.json.php?video_id=$1 last;
      }
      location = /login {
      rewrite ^(.*)$ /objects/login.json.php last;
      }
      location = /logoff {
      rewrite ^(.*)$ /objects/logoff.php last;
      }
      location = /like {
      rewrite ^(.*)$ /objects/like.json.php?like=1 last;
      }
      location = /dislike {
      rewrite ^(.*)$ /objects/like.json.php?like=-1 last;
      }
      location /update {
      rewrite ^/update/?$ /update/update.php last;
      }
      location = /siteConfigurations {
      rewrite ^(.*)$ /view/configurations.php last;
      }
      location = /updateConfig {
      rewrite ^(.*)$ /objects/configurationUpdate.json.php last;
      }
      location = /charts {
      rewrite ^(.*)$ /view/charts.php last;
      }

      location = /upload/index.php {
      rewrite ^(.*)$ /upload/view/index.php last;
      }

      location = /upload/isAdmin {
      rewrite ^(.*)$ /upload/view/isAdmin.php last;
      }

      location = /upload/removeStreamer {
      rewrite ^(.*)$ /upload/view/removeStreamer.php last;
      }

      location = /upload/priority {
      rewrite ^(.*)$ /upload/view/priority.php last;
      }

      location = /upload/status {
      rewrite ^(.*)$ /upload/view/status.php last;
      }

      location = /upload/serverStatus {
      rewrite ^(.*)$ /upload/view/status.php?serverStatus=1 last;
      }

      location = /upload/upload {
      rewrite ^(.*)$ /upload/view/upload.php last;
      }

      location = /upload/listFiles.json {
      rewrite ^(.*)$ /upload/view/listFiles.json.php last;
      }

      location = /upload/deleteQueue {
      rewrite ^(.*)$ /upload/view/deleteQueue.php last;
      }

      location = /upload/saveConfig {
      rewrite ^(.*)$ /upload/view/saveConfig.php last;
      }

      location = /upload/youtubeDl.json {
      rewrite ^(.*)$ /upload/view/youtubeDl.json.php last;
      }

      location = /upload/send.json {
      rewrite ^(.*)$ /upload/view/send.json.php last;
      }

      location = /upload/streamers.json {
      rewrite ^(.*)$ /upload/view/streamers.json.php last;
      }

      location = /upload/queue.json {
      rewrite ^(.*)$ /upload/view/queue.json.php last;
      }

      location = /upload/queue {
      rewrite ^(.*)$ /upload/view/queue.php last;
      }

      location = /upload/login {
      rewrite ^(.*)$ /upload/objects/login.json.php last;
      }

      location = /upload/logoff {
      rewrite ^(.*)$ /upload/objects/logoff.json.php last;
      }

      location /upload/ {
      rewrite “^/getImage/([A-Za-z0-9=/]+)/([A-Za-z0-9]{3})$” /upload/objects/getImage.php?base64Url=$1&format=$2 last;
      rewrite “^/getImageMP4/([A-Za-z0-9=/]+)/([A-Za-z0-9]{3})/([0-9.]+)$” /upload/objects/getImageMP4.php?base64Url=$1&format=$2&time=$3 last;
      }

      location /upload/getSpiritsFromVideo {
      rewrite ^/getSpiritsFromVideo/([A-Za-z0-9=/]+)/([0-9]+)/([0-9]+)$ /upload/objects/getSpiritsFromVideo.php?base64Url=$1&tileWidth=$2&totalClips=$3 last;
      }

      location /upload/getLinkInfo {
      rewrite ^/getLinkInfo/([A-Za-z0-9=/]+)$ /upload/objects/getLinkInfo.json.php?base64Url=$1 last;
      }

      location ~ “(.*)$” {
      try_files $uri $uri/ =404;
      #img/image404.php?image=$1;
      }
      location ~ “.*$” {
      try_files $uri $uri/ =404;
      #view/error.php$is_args$args;
      }

      • Eugeniusz
        3 years ago

        Gave up, used NGINX as a proxy. The nginx “native” config is still toast.

  • Hi guys,

    I want to install YouPhpTube on my local network only (I don’t want to propagate the DNS to public).

    After configuration of Video Encoder I have this problem: “We could not find your streamer site!”.

    How can I resolve this issue?

    • Xiao Guoan (Admin)
      3 years ago

      You can create a local DNS entry in the /etc/hosts file. If your streamer site is tube.yourdomain.com, then add the domain name to the 127.0.0.1 entry.

      127.0.0.1       localhost ubuntu tube.yourdomain.com
      • Luca T.
        3 years ago

        Hi Xiao Gouan,

        thanks a lot for the quick help, this fixes the issue.

        I got confused because I have bind installed on the same machine … I didn’t thought that server does not know his own full URL 🙂

        Thank a lot!

  • Joaquim Homrighausen
    3 years ago

    There’s a “live” gist for Nginx here (not created by me) that was recently updated:
    https://gist.github.com/patriclougheed/706677ffe2459df3b6587e54fd4a0923

  • Nicolas
    3 years ago

    Hello
    Thanks a lot in first for this excellent tuto

    I have a question :

    I have a domain name with one host and a dedicated server with another, how can I link the two without my dedicated server’s IP address being visible? Thanks a lot

  • Outstanding write-up and links to other references.

    Thanks!!!

  • Jonathan
    3 years ago

    Is there another platform that can be used? I was reading up a lot of complaints and apparently the content uploaded in this one is exposed to the owner which to me sounds very fishy and not very secured.

    • Xiao Guoan (Admin)
      3 years ago

      I don’t know what you mean by “content is exposed to the owner”.

  • I can not upload muy videos. When I am using the encoder and after uploading the file I get the next error: “try [1] Error on return_vars->videos_id”.

    Does somebody know how to solve this problem?

  • Walter Dsouza
    2 years ago
    What you are given installation procedure is fantastic it is worked fine 4-5 days with WebRTC  video but now is stopped. May I know get solve this problem of error. Please get response.
  • -bash: cd: AVideo/: No such file or directory

  • qdwxplwhtabodyrioh
    8 months ago

    I followed the instructions here exactly as described, but I’m encountering the following error:

    array(4) { [“type”]=> int(64) [“message”]=> string(96) “require(): Failed opening required ‘objects/configuration.php’ (include_path=’.:/usr/share/php’)” [“file”]=> string(37) “/var/www/AVideo/objects/functions.php” [“line”]=> int(5016) }

  • Cloning into ‘AVideo’…
    remote: Enumerating objects: 302649, done.
    remote: Counting objects: 100% (9276/9276), done.
    remote: Compressing objects: 100% (2282/2282), done.
    fatal: the remote end hung up unexpectedly.68 MiB | 343.00 KiB/s
    fatal: early EOF
    fatal: index-pack failed

    I made
    git config –global http.postBuffer 500M
    git config –global http.maxRequestBuffer 100M
    git config –global core.compression 0

    No result

Leave a Comment

  • Comments with links are moderated by admin before published.
  • Your email address will not be published.
  • Use <pre> ... </pre> HTML tag to quote the output from your terminal/console.
  • Please use the community (https://community.linuxbabe.com) for questions unrelated to this article.
  • I don't have time to answer every question. Making a donation would incentivize me to spend more time answering questions.

The maximum upload file size: 2 MB. You can upload: image. Links to YouTube, Facebook, Twitter and other services inserted in the comment text will be automatically embedded. Drop file here