Buy Certificates
Buy your SSL certificate from a provider. I got mine from namecheap.
Transfer your SSL certificate bundle files onto your server, for example into /ssl/ folder. (more…)
Getting a good score in Google Pagespeed Insights is very important, as it is a main factor for good User Experience (UX).
Minifying the Javascript, HTML and CSS helps reduce the page load times drastically.
Optimize your images before hosting them online and using them on your site. You can optimize images online for free here. (more…)
If you want to monitor your Amazon Web Services (AWS) Elastic Cloud Compute (EC2) instances using crontab and AWS SDK. Here in this example I have chosen php (7.1).
Install composer
composer require aws/aws-sdk-php
Want to ensure that your services (Apache, MySQL, HHVM) on your linux instance are running 24*7? Then you can use crontab for that. This job runs every minute to check the status of the service and if it is not running then, it starts the service. (more…)
For this example it is recommended that you have the latest most stable release of Node.js + npm installed.
Now you will need express to run a simple server. (more…)
Using a subject to create an observable is the recommended method of inter-component communication by the official angular documentation.
The following code was tested with Angular 5.2.2. (more…)
The following is the fastest way to integrate Google Analytics with your self hosted WordPress website without using any external applications or plugins. By injecting plain javascript into your
tag, you won’t have to worry about incurring the overhead of adding a new plugin to your site for a small 2 line code addition. (more…)You can login as the user you want to delete history from and then use the following command. For example if you want to delete from root
sudo -i cat /dev/null > ~/.bash_history && history -c && exit
sudo crontab -e
The following cronjobs will run every hour. Make sure you replace the database connection string values (make sure you have the right privileges on the database being used.) and backup folder paths with the appropriate ones.
0 * * * * cd /cron/backup && tar -zcvf backup.tar.gz /var/www/html/ 0 * * * * mysqldump -u user_name -p'password' db_name> /cron/backup/backup.sql
Now save the changes and restart the cron service.
Ctrl+O Enter Ctrl+X sudo service cron restart
This php script repairs and optimizes all the tables in the selected database. Make sure you provide the right values in the connection string.
optimize.php
$tablename)
{
if(mysqli_query($link,"REPAIR TABLE `$tablename`"))
{
echo '\nRepair Success: '.$tablename;
}
else
die(mysqli_error($link));
if(mysqli_query($link,"OPTIMIZE TABLE `$tablename`"))
{
echo '\nOptmize Success: '.$tablename;
}
else
die(mysqli_error($link));
}
}
mysqli_close($link);
crontab -e 0 * * * * php /var/www/html/optimize.php Ctrl+O Enter Ctrl+X sudo service cron restart