AWK: how to get text which is between two strings

If you need to get some text which is in file between two lines you could use awk for this. You may need it while analyzing access logs to fix some issue, for instance. Here’s how you could do it: awk ‘/2012:00:20:49/, /2012:00:35/’ access_log > output It’s a simple and convenient way.

Apache: getting remote IP when working behind nginx

Sometimes you may want to use Apache behind nginx. In this case nginx works as reverse proxy and handles user connections and static files. And Apache generates dynamic content (for instance, with use of PHP). In this case remote IP in your scripts would be 127.0.0.1 since Apache gets requests from the same server. It…
Read more

LEMP: disabling PHP functions

Let’s consider typical LEMP stack: Linux nginx php-fpm MySQL server For security reasons you might want to disable some dangerous functions like exec or system.  As you may know, you can do this by adding list of function to disable_functions parameter in your php.ini. At the same time php-fpm allows to limit PHP parameters per pool….
Read more

RPM: how to get changelog from package

Often there’s a need to get changelog of RPM package. Here is a way to do that: [root@playground ~]# rpm -qp –changelog kernel-2.6.41.9-1.fc15.x86_64.rpm | head * Fri Jan 13 2012 Josh Boyer <jwboyer@redhat.com> 2.6.41.9-1 – Linux 3.1.9 – CVE-2012-0045 kvm: syscall instruction induced guest panic (rhbz 773392) * Wed Jan 11 2012 Josh Boyer <jwboyer@redhat.com>…
Read more