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 →

If you can’t start Junier SSL VPN and got the error below in system viewer: taskhost (2940) WebCacheLocal: Database recovery/restore failed with unexpected error -1032 Here is the fix: Delete this file: “C:\Users\username\AppData\Local\Microsoft\Windows\WebCache\WebCacheV01.dat” Wecache is a hidden folder, make sure you change the option to see it.Read 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 →

# BEGIN WordPress <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / # server info and status RewriteRule ^(server-info|server-status) – [L] # RewriteCond %{REQUEST_URI} !=/server-status # /server info and status RewriteCond %{REQUEST_FILENAME} -f RewriteCond %{REQUEST_FILENAME} -d RewriteRule . index.php [L] </IfModule> # END WordPressRead More →