Redis can’t save in background

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  
read more

centos 7 systemctl restart httpd or other service take long time

Well on centos 7 I notice that when I run systemctl restart httpd sometime take a lot of time  to restart it . After some search I found out that there is a TimeoutStopSec variable that do something like this “Configures the time to wait for stop. If a service is asked to stop, but does not terminate in the specified time, it will be terminated forcibly via SIGTERM, and after another timeout of equal duration with SIGKILL (see KillMode= in systemd.kill(5)). Takes a unit-less value in seconds, or a time span value such as “5min 20s”. Pass “infinity” to disable the timeout logic. Defaults to DefaultTimeoutStopSec= from the manager configuration file” So I modify the /usr/lib/systemd/system/httpd.service and added the TimeoutStopSec=5 Into it You need to run systemctl daemon-reload after modify that file [Service]...
read more

delete large directory containing thousands of files

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 https://serverfault.com/questions/183821/rm-on-a-directory-with-millions-of-files/328305#328305  
read more

Modify .htaccess on wordpress site to move to new domain

In order to move the wordpress to new domain you must modify the .htaccess with   #Options +FollowSymLinks RewriteEngine on RewriteRule ^(.*)$ http://www.newdomain.com$1 [R=301,L]
read more

httpd with multiple ssl and password for every key automatically

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   #!/bin/perl $server = $ARGV[0]; #print $server; if ($server eq ‘www.example.com:443’ || $server eq ‘www.example2.com:443’ ) { print ‘password one’; } elsif ($server eq ‘example3.com’) { print ‘Password two’; }...
read more

Adding trusted root certificates to the server

Linux (Ubuntu, Debian) Function Method Add Copy your CA to dir /usr/local/share/ca-certificates/ Use command: sudo cp foo.crt /usr/local/share/ca-certificates/foo.crt Update the CA store: sudo update-ca-certificates Remove Remove your CA. Update the CA store: sudo update-ca-certificates –fresh   Linux (CentOs 6) Function Method Add Install the ca-certificates package: yum install ca-certificates Enable the dynamic CA configuration feature: update-ca-trust force-enable Add it as a new file to /etc/pki/ca-trust/source/anchors/: cp foo.crt /etc/pki/ca-trust/source/anchors/ Use command: update-ca-trust extract   Linux (Centos 5) Add Append your trusted certificate to file /etc/pki/tls/certs/ca-bundle.crt cat foo.crt...
read more

« Previous Entries