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

July 14, 2020

redirect to https

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

I have more versions of redirect

RewriteEngine On
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$$1 [R,L]

Other version is

#non-www. http to www. https
RewriteCond %{ENV:HTTPS} !on
RewriteCond %{HTTP_HOST} ^(www.)?$
RewriteRule (.*)$1 [R=301,L]

#non-www. https to www. https
RewriteCond %{ENV:HTTPS} on
RewriteCond %{HTTP_HOST} ^$
RewriteRule (.*)$1 [R=301,L]

Other version is

RewriteEngine on

RewriteCond %{HTTPS} off [OR]
RewriteCond %{HTTP_HOST} !^www.
RewriteRule ^{REQUEST_URI} [NC,L,R=301,NE]

Another one :

RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

June 2, 2020

Change docker root directory by creating a systemd drop-in service file

Filed under: Linux — Tags: , , — admin @ 2:20 pm

 It is possible to change docker root directory by creating a systemd drop-in service file. This is useful when you want images and containers or docker generated files to be located in another partition or drive.

Create drop-in configuration file

  1. Create the systemd directory:
    sudo mkdir /etc/systemd/system/docker.service.d/
  2. Create the docker.service drop-in file:
    sudo nano /etc/systemd/system/docker.service.d/docker.root.conf
  3. Add the following configuration :
ExecStart=/usr/bin/dockerd -g /your/custom/docker/root -H fd://

April 21, 2020

BFD – r-fx network ignore cdir

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

I personally like the r-fx project with apf / bfd firewall . I am using from long time and is great. One of the feature that is missing is that you can not exclude cdir format from bfd. My workarround was to install the grepcidr package and then on line 137 of /usr/local/bfd/bfd to modify it from

CHKHOST_IGNORE=`cat $file | grep -v “#” | grep -w $ATTACK_HOS`


CHKHOST_IGNORE=`/usr/bin/grepcidr -f $file <(echo $ATTACK_HOST)`

After this you can add x.x.x.x/y format

April 8, 2020

Vps with openVZ problems

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

If you ever encounter problems on your vps, first please check this

cat /proc/user_beancounters

If you see failcnt >0 then you have some limitation problems.

August 29, 2019

Bind mount

Filed under: Linux — Tags: , , , — admin @ 1:34 pm
I note this for me . I need to see a log directory on the account over scp. So one soulution for me was to mount with bind the log directory.

mount --bind /some/where /mnt/readonly
mount -o remount,ro,bind /mnt/readonly
Older Posts »

Powered by WordPress