Blog

  • mod_fcgid: HTTP request exceeds MaxRequestLen

    On a ISPConfig server with PHP running in FCGI Mode, i get following error in error_log when upload images from WordPress admin area.

    [Tue Apr 03 13:45:11 2018] [warn] [client 112.133.237.47] mod_fcgid: HTTP request length 139264 (so far) exceeds MaxRequestLen (131072), referer: https://www.url.com/wp-admin/media-new.php

    ISPConfig store error log for site in “log” directory in parent folder of document root. In this case, it was

    /var/www/clients/client0/web1/log/error.log
    

    To fix the error add

    FcgidMaxRequestLen 1073741824
    

    to fcgi.conf

    On Ubuntu/Debian, you file location is

    vi /etc/apache2/mods-available/fcgid.conf
    

    On CentOS/RHEL

    vi /etc/httpd/conf.d/fcgid.conf
    
  • Create SSL pem file

    To make .pem file from SSL certificate, run

    cat  yourdomain.key yourdomain.crt yourdomain.ca-bundle > yourdomain.pem
    

    Here is the format

    -----BEGIN RSA PRIVATE KEY----- 
    (Private Key: domain_name.key contents) 
    -----END RSA PRIVATE KEY-----
    -----BEGIN CERTIFICATE----- 
    (Primary SSL certificate: domain_name.crt contents) 
    -----END CERTIFICATE----- 
    -----BEGIN CERTIFICATE----- 
    (Intermediate certificate: certChainCA.crt contents) 
    -----END CERTIFICATE----
    

    ssls/namecheap SSL example

    cat domain_com_key.txt domain.com/domain.com.crt domain.com/domain.com.ca-bundle > ssl.pem
    
  • lighttpd

    lighttpd is a lightweight web server used mainly to serve static files. Youtube used lighttpd before it was purchased by Google. I was using lighttpd with some file hosting/image hosting sites with mod_secdownload that allows the link to expire after a predefined time.

    To install Lighttpd on CentOS, run

    yum install lighttpd
    

    To see lighttpd version, run

    lighttpd -v
    
  • Plesk

    Plesk is a powerful web hosting control panel that allows you to easily manage your websites, domains, and email accounts. It is a user-friendly platform that simplifies the process of managing your online presence, making it accessible to users of all skill levels.

    Install

    General

    Plesk Upgrade

    Plesk Server Configuration

    Plesk CLI

    MySQL upgrade

    Plesk Errors

    Plesk Port

    https://IP_ADDR:8443
    http://IP_ADDR:8880
    

    Plesk Paths

    /opt/plesk/php/7.0/bin/php
    

    See Hosting Control Panel

  • Run .html files as PHP in Apache

    On Ubuntu, to execute .htm files as PHP, create file

    vi /etc/apache2/conf-enabled/php-html.conf
    

    Add following content

    
        SetHandler application/x-httpd-php
    
    

    This is similar code from your PHP configuration. In this case, it is from /etc/apache2/mods-available/php5.6.conf

    If you want it only for a specific website, edit VirtualHost entry for the website and add

    
            SetHandler application/x-httpd-php
    
    

    Example

    
        ServerName serverok.in
        ServerAlias www.serverok.in
        DocumentRoot /home/www/serverok.in/html
        CustomLog ${APACHE_LOG_DIR}/serverok.in.log combined
        
            Options All
            AllowOverride All
            Require all granted
            Order allow,deny
            allow from all
        
        
                SetHandler application/x-httpd-php
        
    
    

    Now restart apache

    service apache2 restart
    

    Apache | PHP

  • RailWire 2018 FTTH BroadBand Plans

    RailWire, Government of india owned ISP that provide FTTH connection through Cable TV operators have come up with new boardband plans for 2018.

    Unlike previous plan, new plan offers lot of bandwidth for every plan. This help with Indias new media consumption started by Reliance JIO. Previous Maximum speed available was 100 Mbps. New maximum is 200 Mbps.

    RailWire 2018 FTTH Plans

    These new plans are not yet updated on RailWire web site, but many have reported new customers are getting these plans. My plan just got changed from 20 Mbps to 75 Mbps, 300 GB per month data transfer with same price as before.

    Reliance JIO made indians internet usage explode with very generous 4G mobile plans that give 1.5 GB data per day with free NetFlix like media service JioCinema and lot of Free TV Channels using JioTV Live TV App. These media services make any none internet users addicted to internet and data, they never able to live Reliance JIO even if they wanted.

    With Reliance JIO coming with with FTTH service with many part of the country, RailWire may be doing their part to keep their customers happy.

    new and old railwire plans are

    Old plan New FUB Data Plane Afther Speed Without TAX 18% tax
    2Mbps 10gb 10Mbps 50gb port speed 512Kbps Rs. 599 706.82/-
    2Mbps 20gb 20Mbps 100gb port speed 512Kbps Rs. 699 824.82/-
    4Mbps 40gb 40Mbps 200gb port speed 512Kbps Rs. 799 942.82/-
    10Mbps 80gb 50Mbps 250gb port speed 512Kbps Rs. 899 1060.82/
    20Mbps 100g 75Mbps 300gb port speed 512Kbps Rs. 949 1119.82/-
    40Mbps 60gb 100Mbps 350gb port speed 512Kbps Rs. 999 1178.82/-
    60Mbps 100g 125Mbps 400gb port speed 512Kbps Rs. 1,249 1473.82/-
    80Mbps 130g 150Mbps 450gb port speed 512Kbps Rs. 1,499 1768.82/-
    90Mbps 100g 175Mbps 500gb port speed 512Kbps Rs. 1,899 2240.82/-
    100Mbp 210g 200Mbps 550gb port speed 512Kbps Rs. 1,949 2299.82/

    These new plans make more internet services available in India.

    Indian Gamers will have good time with local game servers, so far they have to use Singapore, Europe or US servers to play games, that cause high lag in games with response time is critical to success.

    Online backup services will get more popular. I have 3 hard disks in my computer for backing up data because i don’t want to waste any of my bandwidth, with 75 Mbps or 100 Mbps connection, i may start using cloud backup services for backing up some of my data.

    Here is speed test on my 75 Mbps connection

    Railwire FTTH  speed test 2018

    Next month i may switch to 100 Mbps plan as price difference is very small (INR 59) even though it won’t make any difference in normal usage.

    I switch from BSNL to RailWire nearly a year ago. BSNL speed was 2 Mbps, they have very low FUP limit of 20 GB per month.

    http://www.bsnl.co.in/opencms/bsnl/BSNL/services/broadband/BB_plans_less_speed.html

    Even now they don’t change the plans. For INR 945, you get 10 Mbps speed until 20 GB FUP Limit, then speed goes down to 2 Mbps. Problem with BSNL for me was not speed, it was frequent down time due to cable problems as they use DSL and the cable are very old break multiple times a month and it take days for them to find the fault and fix it.

  • veeam

    veeam is a backup software

    https://www.veeam.com

    On a CentOS server, it install following packages

    [root@67 ~]# rpm -qa | grep veeam
    kmod-veeamsnap-2.0.0.400-1.el6.x86_64
    veeam-2.0.0.400-1.el6.x86_64
    veeam-release-el6-1.0-1.x86_64
    [root@67 ~]# 
    

    It have a ncurses based GUI, that you can start with command

    veeam
    

    Home page shows backup logs, you can press enter to see the log.

    You can set backup server configurations by pressing C

    You can mount backups through the menu.

    Backup now mounted in /mnt/backup

    [root@67 ~]# mount 
    /dev/sda3 on / type ext4 (rw)
    proc on /proc type proc (rw)
    sysfs on /sys type sysfs (rw)
    devpts on /dev/pts type devpts (rw,gid=5,mode=620)
    tmpfs on /dev/shm type tmpfs (rw)
    /dev/sda1 on /boot type ext4 (rw)
    /dev/sdb1 on /data type ext4 (rw)
    none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw)
    sunrpc on /var/lib/nfs/rpc_pipefs type rpc_pipefs (rw)
    veeamagent on /mnt/backup/{decdcc23-4343-4ca6-a1e4-58a124518b48}/disks type fuse.veeamagent (rw,nosuid,nodev)
    [root@67 ~]# cd /mnt/backup/
    [root@67 backup]# ls -la
    
    total 142
    dr-xr-xr-x.  27 root root  4096 Mar 29 10:01 .
    drwxr-xr-x.   3 root root  4096 Mar 30 00:08 ..
    -rw-r--r--    1 root root     0 Mar 21 07:13 .autofsck
    -rw-r--r--    1 root root     0 Mar 21 07:13 .autorelabel
    drwxr-xr-x    2 root root  4096 Mar 29 09:50 backup
    dr-xr-xr-x.   2 root root  4096 Mar 29 03:12 bin
    dr-xr-xr-x.   5 root root  1024 Mar 29 10:01 boot
    drwxr-xr-x.   2 root root  4096 Oct  3 21:52 cgroup
    drwxr-xr-x.   3 root root  4096 Mar 29 10:03 data
    drwxr-xr-x.   2 root root  4096 Mar 21 07:03 dev
    drwxr-xr-x. 111 root root 12288 Mar 29 09:39 etc
    drwxr-xr-x.   2 root root  4096 Sep 23  2011 home
    dr-xr-xr-x.  11 root root  4096 Mar 28 05:12 lib
    dr-xr-xr-x.  10 root root 12288 Mar 29 03:12 lib64
    drwx------.   2 root root 16384 Mar 21 07:02 lost+found
    drwxr-xr-x.   2 root root  4096 Sep 23  2011 media
    drwxr-xr-x.   2 root root  4096 Feb 21  2013 misc
    drwxr-xr-x.   2 root root  4096 Sep 23  2011 mnt
    drwxr-xr-x.   2 root root  4096 Feb 21  2013 net
    drwxr-xr-x.   3 root root  4096 Mar 21 07:09 opt
    drwxr-xr-x.   2 root root  4096 Mar 21 07:03 proc
    -rw-r--r--    1 root root     0 Mar 21 08:59 .readahead_collect
    dr-xr-x---.   5 root root  4096 Mar 29 09:39 root
    dr-xr-xr-x.   2 root root 12288 Mar 29 03:12 sbin
    drwxr-xr-x.   2 root root  4096 Mar 21 07:04 selinux
    drwxr-xr-x.   2 root root  4096 Sep 23  2011 srv
    drwxr-xr-x.   2 root root  4096 Mar 21 07:03 sys
    drwxrwxrwt.  13 root root  4096 Mar 29 10:00 tmp
    drwxr-xr-x.  14 root root  4096 Mar 29 09:20 usr
    drwxr-xr-x.  22 root root  4096 Mar 29 09:39 var
    [root@67 backup]#
    

    Backup

  • chkconfig

    chkconfig is a command available in CentOS 6 to set a service start on boot.

    To start lighttpd on boot run.

    chkconfig --levels 235 lighttpd on
    

    chkconfig command list all services and its run levels.

    [root@server12 ~]# chkconfig
    acpid          	0:off	1:off	2:on	3:on	4:on	5:on	6:off
    atd            	0:off	1:off	2:off	3:on	4:on	5:on	6:off
    auditd         	0:off	1:off	2:on	3:on	4:on	5:on	6:off
    blk-availability	0:off	1:on	2:on	3:on	4:on	5:on	6:off
    cgconfig       	0:off	1:off	2:on	3:on	4:on	5:on	6:off
    cgred          	0:off	1:off	2:off	3:off	4:off	5:off	6:off
    crond          	0:off	1:off	2:on	3:on	4:on	5:on	6:off
    csf            	0:off	1:off	2:on	3:on	4:on	5:on	6:off
    dnsmasq        	0:off	1:off	2:off	3:off	4:off	5:off	6:off
    docker         	0:off	1:off	2:on	3:on	4:on	5:on	6:off
    ebtables       	0:off	1:off	2:off	3:off	4:off	5:off	6:off
    exim           	0:off	1:off	2:on	3:on	4:on	5:on	6:off
    haldaemon      	0:off	1:off	2:off	3:on	4:on	5:on	6:off
    htcacheclean   	0:off	1:off	2:off	3:off	4:off	5:off	6:off
    httpd          	0:off	1:off	2:on	3:on	4:on	5:on	6:off
    ip6tables      	0:off	1:off	2:on	3:on	4:on	5:on	6:off
    iptables       	0:off	1:off	2:off	3:off	4:off	5:off	6:off
    iscsi          	0:off	1:off	2:off	3:on	4:on	5:on	6:off
    iscsid         	0:off	1:off	2:off	3:on	4:on	5:on	6:off
    lfd            	0:off	1:off	2:on	3:on	4:on	5:on	6:off
    lvm2-monitor   	0:off	1:on	2:on	3:on	4:on	5:on	6:off
    lxc            	0:off	1:off	2:off	3:off	4:off	5:off	6:off
    mdmonitor      	0:off	1:off	2:on	3:on	4:on	5:on	6:off
    messagebus     	0:off	1:off	2:on	3:on	4:on	5:on	6:off
    mysqld         	0:off	1:off	2:on	3:on	4:on	5:on	6:off
    netcf-transaction	0:off	1:off	2:on	3:on	4:on	5:on	6:off
    netconsole     	0:off	1:off	2:off	3:off	4:off	5:off	6:off
    netfs          	0:off	1:off	2:off	3:on	4:on	5:on	6:off
    network        	0:off	1:off	2:on	3:on	4:on	5:on	6:off
    newrelic-sysmond	0:off	1:off	2:on	3:on	4:on	5:on	6:off
    nginx          	0:off	1:off	2:on	3:on	4:on	5:on	6:off
    ntpd           	0:off	1:off	2:off	3:off	4:off	5:off	6:off
    ntpdate        	0:off	1:off	2:off	3:off	4:off	5:off	6:off
    numad          	0:off	1:off	2:off	3:off	4:off	5:off	6:off
    pure-ftpd      	0:off	1:off	2:on	3:on	4:on	5:on	6:off
    radvd          	0:off	1:off	2:off	3:off	4:off	5:off	6:off
    rdisc          	0:off	1:off	2:off	3:off	4:off	5:off	6:off
    redmine        	0:off	1:off	2:on	3:on	4:on	5:on	6:off
    restorecond    	0:off	1:off	2:off	3:off	4:off	5:off	6:off
    rsyslog        	0:off	1:off	2:on	3:on	4:on	5:on	6:off
    saslauthd      	0:off	1:off	2:off	3:off	4:off	5:off	6:off
    smartd         	0:off	1:off	2:off	3:off	4:off	5:off	6:off
    sshd           	0:off	1:off	2:on	3:on	4:on	5:on	6:off
    svnserve       	0:off	1:off	2:off	3:off	4:off	5:off	6:off
    sysstat        	0:off	1:on	2:on	3:on	4:on	5:on	6:off
    udev-post      	0:off	1:on	2:on	3:on	4:on	5:on	6:off
    vnstat         	0:off	1:off	2:on	3:on	4:on	5:on	6:off
    yum-cron       	0:off	1:off	2:on	3:on	4:on	5:on	6:off
    [root@server12 ~]# 
    
  • ffmpeg

    FFmpeg is a command-line program available for Linux, windows, and mac. It is used to convert videos from one format to another. Many professional video encoders depend on FFmpeg to do the encoding in the background.

    Install ffmpeg

    How to use ffmpeg

    Streaming

    Steaming to Anti Media Server using ffmpeg

    Convert mp4 to hls stream

    ffmpeg -i video.mp4 -codec: copy -start_number 0 -hls_time 10 -hls_list_size 0 -f hls video.m3u8

    Saving a steam with ffmpeg

    ffmpeg -i "stream_url" -c copy -f mpegts test.ts

    Example

    The following command will save the steam as 1.mp4

    ffmpeg -i "rtmp://cp.livecastnet.com:1935/85nortetv/live" 1.mp4

    To convert video into HLS steam

    ffmpeg -i video.mp4 -codec: copy -start_number 0 -hls_time 10 -hls_list_size 0 -f hls 1.m3u8

    error: ‘x264_bit_depth’ undeclared (first use in this function

  • Install FFmpeg on CentOS using yum

    Install epel repository using

    yum install epel-release -y

    Method 1

    Install rpmfusion for your distro

    https://rpmfusion.org/Configuration

    For CentOS 8

    rpm -ivh https://mirrors.rpmfusion.org/free/el/rpmfusion-free-release-8.noarch.rpm

    For CentOS 7

    rpm -ivh https://download1.rpmfusion.org/free/el/rpmfusion-free-release-7.noarch.rpm

    Install ffmpeg with

    yum install ffmpeg

    2023-02-20 On CentOS 7, repo provided ffmpeg version 3.4.12. scrpms repo had a newer version.

    Method 2

    Install scrpms repo

    On CentOS 7

    wget http://scrpms.net/pub/RPMS/el7/x86_64/scrpms-repo-22-3.el7.x86_64.rpm
    rpm -ivh scrpms-repo-22-3.el7.x86_64.rpm

    Install ffmpeg with

    yum install ffmpeg ffmpeg-devel

    NOTE:

    2019-12-11 i tested it on CentOS 7. ffmpeg worked. Version is 4.2.1. mplayer/mencoder install failed with dependency error.

    2023-02-20 CentOS 7 ffmpeg version 5.1.2

    Method 3

    http://li.nux.ro/repos.html

    On CentOS 7

    rpm -Uvh http://li.nux.ro/download/nux/dextop/el7/x86_64/nux-dextop-release-0-5.el7.nux.noarch.rpm

    Install ffmpeg with

    yum install ffmpeg ffmpeg-devel

    NOTE: On 2019-12-11 i tested it on CentOS 7. ffmpeg and mencoder install worked. But version is very old. ffmpeg version 2.8.15. MPlayer SVN-r37391-4.8.3

    See ffmpeg

  • VMware Horizon

    VMware Horizon is a Virtual desktop infrastructure (VDI) allow you to virtualize desktops.

    https://www.vmware.com/in/products/horizon.html

    Horizon allow you to virtualize applications on the cloud or local data centre allowing employees to access remotely.

    Clients are available for Linux, Windows and Mac from

    https://my.vmware.com/web/vmware/info?slug=desktop_end_user_computing/vmware_horizon_clients/4_0