Let say you have 2 virtual hosts A.com and B.com on your web server, do you know that it is possible that your visitor may accidentally access A.com while browsing B.com? As a best practice, defining a catch-all Virtual host can prevent such scenario. Continue reading “Define a Catch-all Named Virtual Host in Apache”
Memcached is a distributed Memory caching system, it is probably the de facto standard of caching facility for high performance web applications. In short, it is a key-value store which runs entirely in the memory, so it’s extremely fast and also proven to be reliable to handle high traffic.
Steps to install on CentOS (just works!)
Run the following commands one by one in the terminal, this will install the memcached server, and the PHP “Memcahe” classes needed to be used by Continue reading “Install Memcached with PHP extensions in 5 mins (CentOS)”
To use MongoDB in PHP, you are required to install a driver extension to the PHP environment. In CentOS, it’s in fact very straight forward.
This tutorial works for CentOS 6.x, you can also do this by the following command,
$ sudo yum install php-pecl-mongo
You might first need the Remi Repo if you have not, tutorial on how to install that here.
If you use CentOS 7, you can also install by the above command without installing additional repo.
Original Post (Still works, and you will guarantee using the latest version of the mongodb driver):
Prepare the tools to build PHP extensions
This step is extremely easy with yum, but if you want to use the latest version of PHP, this article does not cover that.
sudo yum install php-devel php-pear
Get the latest MongoDB PHP driver source
The source code is hosted in GitHub, you can find it here .
git clone https://github.com/mongodb/mongo-php-driver
Build the driver
The following steps are also mentioned in the readme of mongodb php driver
sudo make install
If all went well, the mongo.so should be installed in /usr/lib64/php/modules/
now go to /etc/php.d
echo "extension=mongo.so" > mongo.ini
Restart Apache to make the change effective
sudo service httpd restart
Today I have found that there is an IP in Turkey keep trying to login to my server, and I’ve found that my current settings has no protection against this brute-force login, so I did a Google search on this and would like to share with you guys.
To check if your server is currently being attacked via ssh, use this command
> tcpdump port ssh
In CentOS, the sshd config is located at /etc/ssh/sshd_config, I have uncommented the following lines:
you can also limit root access, allow only certain IP to access the ssh etc, however I’m using dynamic IP ISP and I’m used to root ssh access, so I only use these settings.
Relying only on sshd_config is not enough, the attack host still keep sending login requests and could possibly paralyse the network traffic of linux box. I need to find a way to Continue reading “Protect your server from SSH attack”