Installing and configuring ClipBucket and Nginx on CentOS 7

In this tutorial, you will install and configure ** ClipBucket ** and ** Nginx ** on a ** Alibaba Cloud Elastic Compute Service (ECS) instance ** using ** CentOS 7 **.

Alibaba Cloud Tech Share Written by Alslan Ud Din Shafiq. Tech Share is an Alibaba Cloud incentive program that encourages sharing of technical knowledge and best practices within the cloud community.

ClipBucket is an open source media and video management system, available in free and paid versions. ClipBucket allows you to launch multi-screen, branded video-on-demand (VOD) content. ClipBucket integrates LDAP and allows you to set ad credentials. ClipBucket's revenue sharing system also allows you to manage RPM (revenue per 1,000 impressions) by region.

ClipBucket does not restrict installation to any particular OS (operating system). You can use your favorite OS, but the installation procedure differs depending on the OS. In this tutorial, you will install and configure ClipBucket and Nginx on your Alibaba Cloud Elastic Compute Service (ECS) instance using CentOS 7.

Prerequisites

--You need to enable Alibaba Cloud Elastic Compute Service (ECS) and confirm your payment method. If you are a new user, you can get a free account (https://account-intl.aliyun.com/register/intl_register.htm?spm=a2c65.11461447.0.0.71bb26daJjXlHH&biz_params=%7B%22intl%22%3A%22%7B%5C%22referralCode%5C%22%3A%5C%22ffxt3q%5C%22%7D%22%7D) with your Alibaba Cloud account. If you don't know how to set up an ECS instance, see this tutorial (https://www.alibabacloud.com/blog/3-ways-to-set-up-a-linux-server-on-alibaba-cloud_572384?spm=a2c65.11461447.0.0.71bb26daJjXlHH) or the Quick Start Guide (https://www.alibabacloud.com/help/doc-detail/25422.htm?spm=a2c65.11461447.0.0.71bb26daJjXlHH). The ECS instance must have at least 1GB of RAM and one Core processor. --Domain Name registered from Alibaba Cloud. If you have already registered your domain from Alibaba Cloud or another host, you can update its domain name server record. --Open ports 80 and 443 for TCP connections in the security group.

Installing the RPMFusion repository

ClipBucket requires back-end multimedia software such as FFmpeg and MP4Box. These softwares are needed to convert uploaded videos to be compatible with the backend. These software are not in the Epel release or the official CentOS repositories. To install the RPMFusion Repository, run the following command.

sudo yum localinstall --nogpgcheck [https://download1.rpmfusion.org/free/el/rpmfusion-free-release-7.noarch.rpm](https://download1.rpmfusion.org/free/el/rpmfusion-free-release-7.noarch.rpm?spm=a2c65.11461447.0.0.71bb26daJjXlHH&file=rpmfusion-free-release-7.noarch.rpm) -y

Reboot the system with the following command.

 sudo yum update -y && sudo shutdown -r now

After rebooting, you will need to access ECS again via Putty. Remember to use the newly added username and sudo privileges to log in to ECS. You need to install unzip to uncompress the compressed folder. Execute the following command.

sudo yum -y install unzip

To install FFmpeg, run the following command.

sudo yum install ffmpeg gpac -y

You need to have Ruby installed to proceed. To install Ruby, first install the yaml library with the following command.

sudo yum install libyaml -y

To install the latest version of Ruby, run the following command.

sudo rpm -ivh [https://github.com/feedforce/ruby-rpm/releases/download/2.5.0/ruby-2.5.0-1.el7.centos.x86_64.rpm](https://github.com/feedforce/ruby-rpm/releases/download/2.5.0/ruby-2.5.0-1.el7.centos.x86_64.rpm?spm=a2c65.11461447.0.0.71bb26daJjXlHH&file=ruby-2.5.0-1.el7.centos.x86_64.rpm)

Install the latest version of the RubyGems packaging program.

sudo yum install rubygems -y

Then install the latest version of FLV Tool 2.

sudo gem install flvtool2

Finally, to install the latest versions of MPlayer, Mediainfo and ImageMagick, run the following command:

sudo yum install ImageMagick mediainfo mplayer -y

MariaDB server installation

MariaDB is included in CentOS by default. The default MariaDB version is 5.5.x and is available in the CentOS default repository. To install the latest version of MariaDB Server, you need to add the MariaDB RPM repository. For the latest version, follow the steps below. Run the following sed command to create a custom file MariaDB.repo in the /etc/yum.repos.d/ directory.

sudo su -c "echo -e '[mariadb]nname = MariaDBnbaseurl = [http://yum.mariadb.org/10.2/centos7-amd64ngpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB](https://yum.mariadb.org/RPM-GPG-KEY-MariaDB?spm=a2c65.11461447.0.0.71bb26daJjXlHH)ngpgcheck=1' > /etc/yum.repos.d/MariaDB.repo”

Run the following command to proceed with the MariaDB server installation.

sudo yum install MariaDB-server -y

Run the following command to enable and start the MariaDB server so that it starts automatically when the system reboots.

sudo systemctl start mariadb
sudo systemctl enable mariadb

Run the command to secure the MariaDB server.

sudo mysql_secure_installation

The root password is blank by default, so press Enter to proceed and select Y to select the password. A series of questions will be displayed. Accept everything until you confirm that the MariaDB server has been successfully secured. If your enterprise plans to use this solution, Alibaba Cloud Aspara DB for RDS (https://account-intl.aliyun.com/register/intl_register.htm?spm=a2c65.11461447.0.0.71bb26daJjXlHH&biz_params=%7B%22intl%22%3A%22%7B%5C%22referralCode%5C%22%3A%5C%22ffxt3q%5C%22%7D%22%7D) is a better option for your database. With Alibaba Cloud AsparaDB for RDS, you can focus on your business without having to manage your database.

PHP and extension installation

To process PHP, you need to install and configure the PHP-FPM daemon. A REMI repository is required to install the new version of PHP-FPM. Follow the steps below to achieve what you need. To install the REMI repository, run the following command.

sudo yum install [http://rpms.remirepo.net/enterprise/remi-release-7.rpm](http://rpms.remirepo.net/enterprise/remi-release-7.rpm?spm=a2c65.11461447.0.0.71bb26daJjXlHH&file=remi-release-7.rpm) -y

To install the required extension for PHP, run the following command.

sudo yum install php70-php-cli php70-php-pecl-imagick php70-php-fpm php70-php-mysql php70-php-opcache -y

Make a backup of the php-fpm.conf file in the directory/etc/opt/remi/php70/and run the following command to rename it to php-fpm.conf.real.

sudo mv /etc/opt/remi/php70/php-fpm.conf /etc/opt/remi/php70/php-fpm.conf.real

Make a backup of the php.ini file located in the directory /etc/opt/remi/php70/ and run the following command to rename it to php.ini.real.

sudo mv /etc/opt/remi/php70/php.ini /etc/opt/remi/php70/php.ini.real

Make a backup of the www.conf file located in the directory /etc/opt/remi/php70/php-fpm.d/ and run the following command to rename it to www.conf.real.

sudo mv /etc/opt/remi/php70/php-fpm.d/www.conf /etc/opt/remi/php70/php-fpm.d/www.conf.real

Run the following command to create a new file named php-fpm.conf.

sudo su -c "echo -e 'include=/etc/opt/remi/php70/php-fpm.d/*.confn[global]ndaemonize = yesnemergency_restart_threshold = 2nemergency_restart_interval = 1mnerror_log = /var/log/php-fpm/php-fpm-7.0-error.lognpid = /var/run/php-fpm-7.0.pidnprocess_control_timeout = 10。 0-error.lognpid = /var/run/php-fpm-7.0.pidnprocess_control_timeout = 10s' > /etc/opt/remi/php70/php-fpm.conf”

Run the following command to create a new file named www.conf.

 sudo su -c "echo -e '[www]ngroup = apachenlisten = /var/run/php-fpm-7.0.socknlisten.backlog = 65536nlisten.owner = apachenlisten.group = apachenpm = staticnpm.max_children = 2npm.max_requests = 10240nuser = apache' > /etc/opt/remi/php70/php-fpm.d/www.conf”

Execute the following command to create a new file named php.ini.

sudo su -c "echo -e '[PHP]nallow_url_fopen = Onnalways_populate_raw_post_data = -. 1ndisplay_errors = Offnerror_reporting = E_ALL & ~E_DEPRECATED & ~E_STRICTnexpose_php = Offnlog_errors = Onnmax_execution_time = 7201nmemory_limit = 7201nmemory_limit 256Mnoutput_buffering = 4096npost_max_size = 256Mnregister_argc_argv = Offnrequest_order = "GP "nupload_max_filesize = 256Mnvariables_order = "GPCS "n[Date]ndate. timezone = America/New_Yorkn[Session]nsession.cache_limiter =nsession.gc_divisor = 1000nsession.hash_bits_per_character = 5nsession.save_handler = filesnsession. save_path = "/var/opt/remi/php70/lib/php/session/"nurl_rewriter.tags = "a=href,area=href,frame=src,input=src,form=fakeentry"'> /etc/opt/remi/php70/php.ini”

Change to the var/log/directory.

 cd /var/log

Create a folder/directory named php-fpm with the following command.

 sudo mkdir php-fpm

Start the php-fpm server and enable it to start automatically after a reboot.

 sudo systemctl enable php70-php-fpm
sudo systemctl start php70-php-fpm

Nginx server installation

To install the latest version of Nginx Web Server, you need to run the following command:

sudo yum install nginx -y

You need to make a backup of the nginx.conf file and rename it. This file is located in the/etc/nginx directory. To back up and rename it to nginx.conf.real, run the following command:

 sudo mv /etc/nginx/nginx.conf /etc/nginx/nginx.conf.real

Create a new nginx.conf file. To do this, simply copy and execute the following command.

sudo su -c "echo -e 'error_log /var/log/nginx/error_log info;nevents { multi_accept on; worker_connections 1024; }nhttp {ntaccess_log none;ntcharset utf-8;ntclient_body_timeout 10s;ntclient_header_timeout 10s;ntclient_max_body_size 256M;ntdefault_type application/octet-stream;ntgzip_comp_level 6;ntgzip on;ntgzip_proxied any;ntgzip_types application/json application/javascript application/x-javascript application/xml application/xml+rss text/css text/javascript text/plain text/xml;ntgzip_vary on;ntinclude /etc/nginx/mime.types;ntinclude /etc/nginx/conf.d/headers.conf;ntinclude /etc/nginx/sites-enabled/*.conf;ntindex index.html index.php;ntkeepalive_timeout 8 8;ntreset_timedout_connection on;ntsend_timeout 2s;ntsendfile on;ntserver_tokens off;nttcp_nopush on;nttcp_nodelay on;ntupstream php-7.0 { server unix:/var/run/php-fpm-7.0.sock; }n}nuser apache apache;nworker_processes auto;' > /etc/nginx/nginx.conf"

In the etc/nginx directory, run the command to create the site-enabled and site-available directories.

sudo mkdir /etc/nginx/{sites-available,sites-enabled}

To prevent XSS abuse, clickjacking, sniffing, etc., and to prevent access to hidden and sensitive files such as git and .htaccess, put headers.conf, expires.conf, deny in the directory /etc/nginx/conf.d You need to create some files called -log-not-found.conf. To do this, run the following command.

 sudo su -c "echo -e 'location ~ /. { deny all; }nlocation = /(favicon.ico|robots.txt) { log_not_found off; }' > /etc/nginx/conf.d/deny-log-not-found.conf" && sudo su -c "echo -e 'location ~* ^.+. (atom|bmp|bz2|css|doc|eot|exe|gif|gz|ico|jpeg|jpg|js|mid|midi|mp4|ogg|ogg|ogv|otf|pdf|png|ppt|rss|rft|svg|svgz|tar|tgz|ttf|wav|woff|woff2|xls|zip)$ { expires max; log_not_found off; }' > /etc/nginx/conf. d/expires.conf" && sudo su -c "echo -e 'add_header X-Content-Type-Options "nosniff";nadd_header X-Frame-Options "SAMEORIGIN";nadd_header X-Robots-Tag "noarchive,noodp,noydir";nadd_header X-Xss-Protection "1; mode=block"; '> /etc/nginx/conf.d/headers.conf”

Create the imarslan.com.conf file. Replace imarslan.com with your domain name with the following command, just as you did when creating this file.

jsudo su -c "echo -e 'server {\n\tinclude /etc/nginx/conf.d/deny-log-not-found.conf;\n\tinclude /etc/nginx/conf.d/expires.conf;\n\tindex index.php;\n\tlocation / {\n\t\ttry_files \$uri \$uri/ /index.php;\n\t\trewrite ^/(.*)v([0-9]+) /watchvideo.php?v=\$2&\$query_string;\n\t\trewrite ^/([a-zA-Z0-9-]+)/?\$ /view_channel.php?uid=\$1&seo_diret=yes;\n\t\t}\n\tlocation ~ \.php\$ { fastcgi_pass php-7.0; include /etc/nginx/fastcgi.conf; }\n\tlocation /categories {\n\t\trewrite ^/categories/?\$ /categories.php;\n\t\t}\n\tlocation /channel {\n\t\trewrite ^/channel/(.*) /view_channel.php?user=\$1;\n\t\t}\n\tlocation /channels {\n\t\trewrite ^/channels/(.)/(.)/(.)/(.)/(.*) /channels.php?cat=\$1&sort=\$3&time=\$4&page=\$5&seo_cat_name=\$2;\n\t\trewrite ^/channels/([0-9]+) /channels.php?page=\$1;\n\t\trewrite ^/channels/?\$ /channels.php;\n\t\t}\n\tlocation /collection {\n\t\trewrite ^/collection/(.)/(.)/(.*) /view_collection.php?cid=\$1&type=\$2&\$query_string;\n\t\t}\n\tlocation /collections {\n\t\trewrite ^/collections/(.)/(.)/(.)/(.)/(.*) /collections.php?cat=\$1&sort=\$3&time=\$4&page=\$5&seo_cat_name=\$2;\n\t\trewrite ^/collections/([0-9]+) /collections.php?page=\$1;\n\t\trewrite ^/collections/?\$ /collections.php;\n\t\t}\n\tlocation /contact {\n\t\trewrite ^/contact/?\$ /contact.php;\n\t\t}\n\tlocation /create_group {\n\t\trewrite ^/create_group /create_group.php;\n\t\t}\n\tlocation /group {\n\t\trewrite ^/group/([a-zA-Z0-9].+) /view_group.php?url=\$1&\$query_string;\n\t\t}\n\tlocation /groups {\n\t\trewrite ^/groups/(.)/(.)/(.)/(.)/(.*) /groups.php?cat=\$1&sort=\$3&time=\$4&page=\$5&seo_cat_name=\$2; rewrite ^/groups/([0-9]+) /groups.php?page=\$1;\n\t\trewrite ^/groups/?\$ /groups.php;\n\t\t}\n\tlocation /item {\n\t\trewrite ^/item/(.)/(.)/(.)/(.) /view_item.php?item=\$3&type=\$1&collection=\$2;\n\t\t}\n\tlocation /members {\n\t\trewrite ^/members/?\$ /channels.php;\n\t\t}\n\tlocation /my_account {\n\t\trewrite ^/my_account /myaccount.php;\n\t\t}\n\tlocation /page {\n\t\trewrite ^/page/([0-9]+)/(.*) /view_page.php?pid=\$1;\n\t\t}\n\tlocation /photo_upload {\n\t\trewrite ^/photo_upload/(.*) /photo_upload.php?collection=\$1;\n\t\trewrite ^/photo_upload/?\$ /photo_upload.php;\n\t\t}\n\tlocation /photos {\n\t\trewrite ^/photos/(.)/(.)/(.)/(.)/(.*) /photos.php?cat=\$1&sort=\$3&time=\$4&page=\$5&seo_cat_name=\$2;\n\t\trewrite ^/photos/([0-9]+) /photos.php?page=\$1;\n\t\trewrite ^/photos/?\$ /photos.php;\n\t\t}\n\tlocation = /rss {\n\t\trewrite ^(.*)\$ /rss.php;\n\t\t}\n\tlocation /rss {\n\t\trewrite ^/rss/([a-zA-Z0-9].+)\$ /rss.php?mode=\$1&\$query_string;\n\t\t}\n\tlocation /search {\n\t\trewrite ^/search/result/?\$ /search_result.php;\n\t\t}\n\tlocation /signup {\n\t\trewrite ^/signup/?\$ /signup.php;\n\t\t}\n\tlocation = /sitemap.xml {\n\t\trewrite ^(.*)\$ /sitemap.php;\n\t\t}\n\tlocation /upload {\n\t\trewrite ^/upload/?\$ /upload.php;\n\t\t}\n\tlocation /user {\n\t\trewrite ^/user/(.*) /view_channel.php?user=\$1;\n\t\t}\n\tlocation /users {\n\t\trewrite ^/users/?\$ /channels.php;\n\t\t}\n\tlocation /video {\n\t\trewrite ^/video/(.)/(.) /watch_video.php?v=\$1&\$query_string; rewrite ^/video/([0-9]+)(.*) /watchvideo.php?v=\$1&\$query_string;\n\t\t}\n\tlocation /videos {\n\t\trewrite ^/videos/(.)/(.)/(.)/(.)/(.*) /videos.php?cat=\$1&sort=\$3&time=\$4&page=\$5&seo_cat_name=\$2;\n\t\trewrite ^/videos/([0-9]+) /videos.php?page=\$1;\n\t\trewrite ^/videos/?\$ /videos.php?\$query_string;\n\t\t}\n\tlocation /view_topic {\n\t\trewrite ^/view_topic/([a-zA-Z0-9].+)tid([0-9]+) /view_topic.php?tid=\$2&\$query_string;\n\t\t}\n\tserver_name imarslan.com www.imarslan.com;\n\troot /var/www/html;\n}' > /etc/nginx/sites-available/imarslan.com.conf"

You need to create a symbolic link in the imarslan.com.conf file from/etc/nginx/sites-available/to/etc/nginx/sites-enabled /. To do so, execute the following command. Don't forget to change imarslan.com to your domain name.

 sudo su -c "cd /etc/nginx/sites-enabled && ln -s ../sites-available/imarslan.com.conf ." 

Enable and start the Nginx server so that it starts automatically when the system restarts.

 sudo systemctl enable nginx && sudo systemctl start nginx

Install ClipBucket

To install ClipBucket, go to the cd/tmp/directory.

 cd /tmp

Run the command to get a copy of ClipBucket.

 wget [http://downloads.sourceforge.net/project/clipbucket/ClipBucket%20v2/clipbucket-2.8.v3354-stable.zip](http://downloads.sourceforge.net/project/clipbucket/ClipBucket%20v2/clipbucket-2.8.v3354-stable.zip?spm=a2c65.11461447.0.0.71bb26daJjXlHH&file=clipbucket-2.8.v3354-stable.zip)

Create a directory to put the unzipped files of ClipBucket.

 sudo mkdir /var/www/clipbucket

Run the following command to copy the required files to/var/www/clipbucket.

sudo cp -r /tmp/clipbucket-2.8.v3354-stable/upload/* /var/www/clipbucket/
sudo cp /tmp/clipbucket-2.8.v3354-stable/upload/.htaccess /var/www/clipbucket/.htaccess

To give the required permissions, run the following command:

 sudo chmod -R 777 /var/www/clipbucket/includes/
sudo chmod -R 777 /var/www/clipbucket/files/
sudo chmod -R 777 /var/www/clipbucket/images/
sudo chmod -R 777 /var/www/clipbucket/cache/
sudo chmod -R 777 /var/www/clipbucket/cb_install/ 
sudo chown apache:apache -R /var/www/clipbucket/

Creating a database

Access the MariaDB server by running the following command: You will then be prompted for a password, enter the password of your choice and press Enter.

 mysql -u root -p

Run the following query to create a table and assign users to the database.

CREATE DATABASE cbdb;
CREATE USER 'cbdb'@'localhost' IDENTIFIED BY 'Password';
GRANT ALL PRIVILEGES ON cbdb.* TO 'cbdb'@'localhost';
FLUSH PRIVILEGES;
            EXIT;

You have now assigned a user to the database. You can change cbdb to any database name and user name and set any password instead of password. ClipBucket has been successfully installed. You can now access it from your Alibaba Cloud IP address or domain name.

ClipBucket settings

Access ClipBucket from your Alibaba Cloud IP address or domain name. Ok, I Agree, Now let me Continue! Click, then click Continue to Next Step. In the permission settings, the permissions have already been set, so click "Next Step" again. The database setup step adds the database credentials you have configured.

image.png

Clicking Check Connection confirms the connection and redirects you to the ClipBucket administrator credentials settings. After adding the settings, click Save and Continue.

image.png

Set a title and description for the ClipBucket and click Save and Continue.

image.png

Congratulations. This completes the Clip Bucket settings. From here you can access the admin screen and access the website from your domain. The link to the admin screen looks like http://www.yourdomain.com/admin_area/login.php. Replace "your domain" with your real domain name.

Recommended Posts

Installing and configuring ClipBucket and Nginx on CentOS 7
Install nginx on centOS7
I tried installing CentOS 8 on ESXi 6.7
Install Java 9 on windows 10 and CentOS 7
Installing and using Ansible on Ubuntu 16.04
Change JDK and Tomcat versions on CentOS
Switch between GUI and CUI on CentOS6.
Instructions for installing and using the AWS command line (awscli) on CentOS
Command to install nginx / PHP7 / php-fpm on CentOS7
OpenVPN on CentOS 8
Put nginx 1.18 in CentOS6 and set reverse proxy
Steps to set up Postfix and Dovecot on CentOS 8.3
I installed CentOS 8 on Windows 10 using VirtualBox and Vagrant
Struggling ... Installing ImageMagick (CentOS8)
Maven on CentOS 7 tutorial
Docker installation on CentOS 6
Use perltidy on CentOS 8
Install Golang on CentOS 8
Try OpenLiteSpeed on CentOS8
Install Neo4j 4.1.3 on centOS
Tomcat v8 on CentOS7
Install Vertica 10.0 on CentOS 6.10
Zabbix 5 installation on CentOS 8
Use mod_auth_cas on CentOS 8
Install PostgreSQL 12 on Centos8
Install Python 3 on CentOS 7
Use bat on Centos.
Jetty v8 on CentOS7
OpenJDK installation on CentOS 7
Install Mattermost on CentOS 7
Install PostGIS 2.5.5 on CentOS7
Install Redmine 4.1.1 on CentOS 7
Smokeping Install on CentOS7
Install PostgreSQL 13 on CentOS 7.5
Note: Install nginx from official repositories with dnf on CentOS 8
Install rsync on CentOS8 (version check) and file backup (synchronization)