Today I wanted to add HTTPS support using Let’s Encrypt certificates for couple of old sites on very outdated legacy server, running Ubuntu 10.04.4 LTS and apache2.
The default “certbot” client which I’m using on other servers didn’t work because of outdated python and openssl version, so after some googling and trying couple of other clients, I finally found one that worked easy and flawlessly. It’s called acme.sh – https://github.com/Neilpang/acme.sh
Continue reading →
Couple of days ago nginx released nginx-1.10.0 stable version with http2 support.
I was already running nginx from their repos on couple of servers, and as the upgrade was possible just by running apt-get upgrade and adding a single parameter to config file, I decided to give it a try immediately.
I knew http2 use should impact sites with lots of http requests the most, so I compared the results from my hobby site for Latvian gamers – https://exs.lv/ – which has quite a lot of small images and other assets. I removed 3rd party ads so they don’t impact the load times and run couple of tests using gtmetrix.com. The results were pretty impressive for changing a single line of code. Continue reading →
I will show how to use any server with ssh as a proxy, I’m doing this on Debian Linux, but it should be the same on all Debian derivatives, and very similar on any other Linux distribution. I use this method to watch Netflix and bypass country restrictions, and to test website access speed from different locations, but it can be used for many other purposes. Continue reading →
Heres a little trick to kill of unwanted processes that are running for more than X minutes on Linux.
I use this on a production server, where imagemagick and ffmpeg are executed many thousands of times per day and in normal conditions each process takes 0.x to 30 seconds. On rare cases they seem to run out of control and never finish execution or take longer than seems reasonable and worthwhile for the particular task. To free up resources taken by such processes, I decided it would be ok to just kill them if they are running for more than 10 minutes. It may not be a very safe and beautiful way to deal with such processes, but it’s working well for me for years now, so I’ll share… Continue reading →
Yesterday I was trying to generate some PDFs using CakePHP and awesome CakePDF plugin. After some reading around and testing I concluded WkHtmlToPdf should be the best PDF engine to use.
So I installed it on my Debian system running
sudo apt-get install wkhtmltopdf
It installed successfully and I was able to execute the example code from wkhtmltopdf website Continue reading →
Very simple script, for regular backup of a specific directory under Linux.
Create file backup.sh
SOURCE=/path/of/data #what should we backup
DESTINATION=/home/user/backups #where to store backups
DELETEAFTER=5 #how many days should we store the backups
mkdir -p $DESTINATION
tar -zcvf latest-backup.tgz $SOURCE
mv latest-backup.tgz $(date +%y%m%d%H)-backup.tgz
find . -name '*-backup.tgz' -mtime +$DELETEAFTER -delete
Continue reading →
Telegram is a great messaging app which supports many different platforms including Linux.
Unfurtunately, it does not run on Debian 7.x, due to unsupported libc6 version. If you are trying to run Telegram desktop client on older Debian Linux, you will likely experience similar error: Continue reading →
Show total inode usage on Linux devices:
Easy way to find and list directories containing most of the file system inodes on Linux (only under the current working directory), running this command will take some time on large drives):
sudo find . -xdev -type f | cut -d "/" -f 2 | sort | uniq -c | sort -n
Little one liner to find and replace all occurrences of the string in all files of certain type, recursively.
find . -name "*.TYPE_OF_FILE" -print | xargs sed -i 's/SEARCH_PHRASE/REPLACE_PHRASE/g'
Continue reading →
If you need the latest version of ImageMagick, it’s quite simple to compile it from source.
First step – install necessary dependencies and build tools. You may already have some of them, if this is not the first time you’re compiling something from source on your system. Continue reading →