How to , and other stuff about linux, photo, php … Another blog just like others on internet

March 12, 2018

Amazon ec2 ami certbot-auto problem

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

Today tried to renew some ssl and surprise


certbot-auto renew
Error: couldn’t get currently installed version for /opt/
Traceback (most recent call last):
File “/opt/”, line 7, in <module>
from certbot.main import main
File “/opt/”, line 10, in <module>
import josepy as jose
File “/opt/”, line 41, in <module>
from josepy.interfaces import JSONDeSerializable
File “/opt/”, line 8, in <module>
from josepy import errors, util
File “/opt/”, line 4, in <module>
import OpenSSL
File “/opt/”, line 8, in <module>
from OpenSSL import rand, crypto, SSL
File “/opt/”, line 12, in <module>
from OpenSSL._util import (
File “/opt/”, line 6, in <module>
from cryptography.hazmat.bindings.openssl.binding import Binding
ImportError: No module named cryptography.hazmat.bindings.openssl.binding


Well tryied everything

rm -rf /opt/    ( didn’t worked for me )

Reinstalled same problem.

The only solution was this found on a comment on github

$ /opt/ install –upgrade certbot
$ /opt/ –help




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


December 11, 2017

Redis can’t save in background

Filed under: Linux — Tags: , , — admin @ 10:53 am

Well I see something in log

[3765] 30 Jan 11:31:10 * 1 changes in 900 seconds. Saving…
[3765] 30 Jan 11:31:10 # Can’t save in background: fork: Cannot allocate memory

To fix this redis error you need to

echo 1 > /proc/sys/vm/overcommit_memory sysctl vm.overcommit_memory=1


December 8, 2017

delete large directory containing thousands of files

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

Well if you try to remove a directory with multiple files rm will take a long time also some load on that server .

One solution is to rsync a empty directory .

mkdir empty_dir
rsync -a –delete empty_dir/ yourdirectory/

Also a perl can be made but the rsync is easy for me to remeber .

Some more information about this you can find here


November 2, 2017

Modify .htaccess on wordpress site to move to new domain

Filed under: Linux — Tags: , , , — admin @ 10:25 am

In order to move the wordpress to new domain you must modify the .htaccess with


#Options +FollowSymLinks
RewriteEngine on
RewriteRule ^(.*)$$1 [R=301,L]

Older Posts »

Powered by WordPress