How to , and other stuff about linux, photo, php … A linux, photography blog. To remember some linux situation, and fix them quickly.

February 6, 2018

Prevent SSL redirect loop using WordPress and HAProxy

Filed under: Linux — Tags: , , , , — admin @ 11:21 am

I do have a haproxy that is serving the ssl frontend and the apache is on 80 port.  But the wordpress see the 80 port and is not forcing to use the ssl as links for css/js

So to force wordpress to generate ssl internal links you need to add this into wp-config.php

define('FORCE_SSL_ADMIN', true);
define('FORCE_SSL_LOGIN', true);
if ($_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https')

Offcourse on the haproxy you need to have

reqadd X-Forwarded-Proto:\ https


August 30, 2017

httpd with multiple ssl and password for every key automatically

Filed under: Linux — Tags: , , , , — admin @ 1:19 pm

Well to use this we must use the SSLPassPhraseDialog functionality of httpd – apache .

Basically into ssl.conf we put this line or modify the existing one into

SSLPassPhraseDialog exec:/path/script

Where script is read/execute only by root.

And the script is


$server = $ARGV[0];
#print $server;
if ($server eq ‘’ || $server eq ‘’ ) {
print ‘password one’;
} elsif ($server eq ‘’) {
print ‘Password two’;


April 25, 2017

how to disable gzip for specific file

Filed under: Linux,Php — Tags: , , , , , , — admin @ 1:33 pm

The short answer is

RewriteRule ^dashboard/index - [E=no-gzip:1]
SetEnvIf REDIRECT_no-gzip 1 no-gzip

Some explination of that solution

The – means NOOP, E means set variable, 1 is the value. After redirects, the variables are renamed and prepended with REDIRECT_.

This work for php FPM

If you have a mod dso you can use also this

apache_setenv('no-gzip', '1');

February 17, 2015

How to enable Core Dumps in CentOS

Filed under: Linux — Tags: , , , — admin @ 12:17 pm

To enable core dumps for all daemon, please follow these steps:
Edit the /etc/profile. At line 26 of the file, replace this line:
ulimit -S -c 0 > /dev/null 2>&1

with this line:
ulimit -c unlimited >/dev/null 2>&1

Replace this line (around line 138 ) in /etc/init.d/functions
ulimit -S -c 0 >/dev/null 2>&1

with this:
ulimit -S -c ${DAEMON_COREFILE_LIMIT:-0} >/dev/null 2>&1

Enable core-dumping globally by editing the /etc/sysconfig/init file and adding the line:

Enable it for specific daemons by adding this line in the /etc/sysconfig/$daemon:

Optionally, enable core dump for SUID programs:
echo 2 > /proc/sys/fs/suid_dumpable

mkdir /tmp/core
chmod 777 /tmp/core

Edit the /etc/sysctl.conf and add the following:

fs.suid_dumpable = 2
kernel.core_uses_pid = 1
kernel.core_pattern = /tmp/core
Then reload the settings in /etc/sysctl.conf:
sysctl -p

January 23, 2015

Unique visitors from apache log file

Filed under: Linux — Tags: , , — admin @ 11:32 am

Well if you ever want to find out from apache log how many unique visitors you have here is one command

cat /usr/local/apache/domlogs/domain.log |awk '{print $1}' | sort | uniq | wc -l

If you want to find out for a date
cat /usr/local/apache/domlogs/domain.log | grep "\[05/Sep/2010" |awk '{print $1}' | sort | uniq | wc -l

Unique referrers
cat /usr/local/apache/domlogs/domain.log | awk '{print $11};' | awk -F / '{print $3}' | sort | uniq

Number of hits
cat /usr/local/apache/domlogs/domain.log | wc -l

« Newer PostsOlder Posts »

Powered by WordPress