Categories
Tutorial

Keep last N lines of a log file with Cron

If you wish to keep last (bottom) N lines of a log file and delete the older lines, you can use this command with Cron:

echo "$(tail -100 /home/home/public_html/log.txt)" > /home/home/public_html/log.txt

Categories
Tutorial

How to install FFmpeg on CentOS cPanel server

How to install FFmpeg on CentOS cPanel server:

Step 1: Update the system
sudo yum install epel-release -y
sudo yum update -y

Step 2: Install the Nux Dextop YUM repo
There are no official FFmpeg rpm packages for CentOS for now. Instead, you can use a 3rd-party YUM repo, Nux Dextop, to finish the job.

On CentOS 7, you can install the Nux Dextop YUM repo with the following commands:

sudo rpm --import http://li.nux.ro/download/nux/RPM-GPG-KEY-nux.ro
sudo rpm -Uvh http://li.nux.ro/download/nux/dextop/el7/x86_64/nux-dextop-release-0-5.el7.nux.noarch.rpm

For CentOS 6, you need to install another release:

sudo rpm --import http://li.nux.ro/download/nux/RPM-GPG-KEY-nux.ro
sudo rpm -Uvh http://li.nux.ro/download/nux/dextop/el6/x86_64/nux-dextop-release-0-2.el6.nux.noarch.rpm

Step 3: Install FFmpeg and FFmpeg development packages
sudo yum install ffmpeg ffmpeg-devel -y

Step 4: Test drive
Confirm the installation of FFmpeg:

ffmpeg

source: https://forums.cpanel.net/threads/ffmpeg-on-cpanel-server.478751/post-2519691

Categories
Solution

Disable mod_pagespeed for a single user

If you need to disable mod_pagespeed for a single user or domain, you can do so simply by adding the following to .htaccess

<IfModule pagespeed_module>
    ModPagespeed off
</IfModule>

Works with cpanel, directadmin, centos, ubuntu, apache… anything!

Categories
Tutorial

How to get visitor ip on cPanel NGINX Reverse Proxy with PHP

If you are using cPanel NGINX Reverse Proxy setup you may notice PHP $_SERVER['REMOTE_ADDR'] is returning server main IP address instead of visitor IP address.

To get visitor IP address use $_SERVER['HTTP_X_REAL_IP']

Source: https://stackoverflow.com/questions/44145688/remote-addr-ip-from-user-instead-of-nginx-reverse-proxy-server

Categories
Solution

Restoring visitors IP with mod_remoteip

Restoring visitors IP with mod_remoteip on cPanel: https://support.cpanel.net/hc/en-us/articles/360051107513-Restoring-visitors-IP-with-mod-remoteip

Categories
Solution

How to fix Cpanel Account Permissions

How to fix Cpanel Account Permissions

A script to fix permissions and ownership, on files and directories, for cPanel accounts.: https://github.com/PeachFlame/cPanel-fixperms