In some situations,  our web server receive too many connections. The number is much higher than normal, that could be an issue with our code, or we are being attack. While waiting to find a solution, we need a solution to keep the service running. The easiest solution is to restart our web server when it’s go over our limit. We’ll keep the log what the server is running, then restart the server. Later on we can see our log and do the fine tuning. cnt=ps -Af | grep apache2 | grep -v rotatelogs | grep -v grep | wc -l now=date +%Y-%m-%d_%H-%M # changeRead More →

Sendmail use “access” database to control who can use this email server to send email out. It’s easy, just edit this file /etc/mail/access   , but access is a database file, after you edit it you need to recreate database map makemap hash /etc/mail/access < /etc/mail/access   Put your control list in the at the end of the file: [email protected] REJECT cyberspammer.com REJECT TLD REJECT 192.168.0 RELAY 192.168.1 OK   REJECT: reject all email from that source RELAY: allow that IP range to use our server as a relay. OK: allow to send any email even though it's blocked in some other rules.Read More →

I used to put this content in my .htaccess to treat .html as php file, but some how it’s no longer working in godaddy. AddType application/x-httpd-php .htm .html AddHandler x-httpd-php .htm .html I found a solution, use the below text: Options +ExecCGI AddHandler x-httpd-php5-cgi .html  Read More →

Using PHP 7.0 on Ubuntu 16.04 LTS Ubuntu 16.04 has switched to PHP 7.0 with a new infrastructure for PHP package. So, no, you can’t install php5 on Ubuntu 16.04, but you can install PHP 7.0 packages with: apt-get install libapache2-mod-php That will install a virtual package that depends on the latest PHP version and pull libapache2-mod-php7.0 as a dependency. If you are looking for extensions, always use a version-less variant as well (e.g. php-apcu instead of php7.0-apcu) as the PECL extensions are packaged without the version to allow smooth upgrades. Using PHP PPA to coinstall PHP 5.6 with PHP 7.0 There’s an option toRead More →