This works well on my Ubuntu 14.04 # Based on http://fearby.com/article/update-openssl-on-a-digital-ocean-vm/ Method1: $ sudo apt-get update $sudo apt-get install –only-upgrade libssl1.0.0 openssl #check if it patches successfully. $ zgrep -ie “(CVE-2016-2108|CVE-2016-2107)” /usr/share/doc/libssl1.0.0/changelog.Debian.gz Output should be like this: – debian/patches/CVE-2016-2107.patch: check that there are enough – CVE-2016-2107 – debian/patches/CVE-2016-2108-1.patch: don’t mishandle zero if it is – debian/patches/CVE-2016-2108-2.patch: fix ASN1_INTEGER handling in – CVE-2016-2108 Method2: $ sudo apt-get dist-upgrade $ wget ftp://ftp.openssl.org/source/openssl-1.0.2h.tar.gz $ tar -xvzf openssl-1.0.2h.tar.gz $ cd openssl-1.0.2h $ ./config –prefix=/usr/ $ make depend $ sudo make install $ openssl version # OpenSSL 1.0.2h 3 May 2016 # now restart your nginx or other server $Read More →

I have a url like this https://www.dailyithelp.com/countries/us/12%26pensylvania so in normal situation, we only have 3 sub folder: countries,us,12/pensylvainia , but in Apache2 , it treats this as 4 : countries,us,12,pensylvania , Apache 2.4 cheats all url encoded slashes as normal slash , if you want to fix this you have to allow slash in the url. <VirtualHost 127.0.0.1:80> ServerName mywebsite.socm AllowEncodedSlashes On </VirtualHost>Read More →

You got error ” too many connections” when connecting to database, when you check the server “show processlist” you see a lot of process having “sleep” status. Here is the fix: change wait_timeout in /etc/mysql/my.cnf: wait_timeout = 600 # if this number is too low , you will get Lost Connection error when doing query then rebootRead More →

You try to increase your connections to 1000 by editing /etc/mysql/my.cnf (change max_connections=1000) , but when you login to your database, you can only see your mysql only accept upto 214 connections? It’s because the open_files_limit in Ubuntu system, here is the fix: Edit nano /lib/systemd/system/mysql.service And add this line to the end: LimitNOFILE=8192 Then run the 2 below commands or reboot the server systemctl daemon-reload systemctl restart mysql.serviceRead More →

List all php packages installed: dpkg -l | grep php| awk ‘{print $2}’ |tr “\n” ” ” Remove all php package: sudo aptitude purge `dpkg -l | grep php| awk ‘{print $2}’ |tr “\n” ” “` Add PPA sudo add-apt-repository ppa:ondrej/php sudo apt-get update sudo apt-get install php5.6 You can install php5.6 modules too for example sudo apt-get install php5.6-mbstring php5.6-mcrypt php5.6-mysql php5.6-xml Verify your version sudo php -vRead More →

Edit file: /etc/rc.local This file will auto run at startup.   This file is a bash file, it might be run when all the services is not ready yet, such as the internet is not ready. If you run immediately, there might be some problems such as the database connection is not ready yet, you wont be able to connect to database server. It’s better to let this script to sleep for a while, then start the job. This is my file: #!/bin/bash sleep 100 # wait for 100 seconds php /www/jobs/update_records.php    Read More →

Our servers recently were crashed due to a large number connections to web (apache) services, we didn’t see anything abnormal on the web. The server will crash when there are over 150 connections, these connections could just come from one IP. After a long investigation, we realize that the attacker attack us by sending a lot of connections, but somehow they put all the TCP status in CLOSE_WAIT status, apache can’t release this. The solution is , we write this script to kill all httpd process having CLOSE_WAIT status. This seems fixing our problems. <? //Some apache process are in close_wait $cmd=”netstat -ntp | grepRead More →