Setting up a new Web Server – TODO list
This article is a quick manual for new, less experienced web server administrator or those who want to maintain their own VPS dedicated web server. This only pertains to UNIX based server with Apache and related modules installed on it. Its a checkpoint and guidelines for me as well as others who want to having everything configured with security leaks minimized. I am providing a list of tasks below which are necessary for having a basic server running how to install and configure each module is outside the scope of this article however i will try to provide external link for help wherever possible .
- After signing up with Web hosting company you get a minimum one IP address, Slice virtual computer with some disk space, and connection to internet. You also get control panel in web hosting company’s portal to access powerful controls.
- Install a bare-bone UNIX distribution most popular is Ubuntu from control panel.
- Once you have it installed there you must use Ajax console or putty to start accessing your machine from SSH and execute commands from here things will be very easy and hassle free avoiding visits for web control panels.
- For new software to download by the server itself you only need to use APT GET or WGET commands.
- First software we are going to install is webmin which will provide us web interface to control everything from here instead of using commands we should be able to use mouse clicks. This also consists of lots of necessary software.
Security Measures
- If you have SSH server running for accessing remote machine by clients like Putty etc you should enable only root login and disable all other users, also set the root password very strong having more than 10 characters and no dictionary letter, names in it.
- All directories which are indirectly writable by external users (Example file upload via a webpage, file manager console) must be owned by www-data (the auto-generated user that runs Apache server) and have 755 permission on it and all sub directories below it recursively.
Disaster Recovery
- You need to have a cron job that creates periodic database backup of all important database running on the database server. For example if you have mysql db server the following command can be set as cron job to dump a db file periodically “mysqldump -u username-p dbname > /home/user_dir/db_backup/db_backup_$(date +%y%m%d).sql“
Spam Control
- After your website gets slight popularity it becomes victim of email spam and literally hundreds of spam mails are bombarded daily, most of them come from China. The trouble with such mails are spending unnecessary attention /time and searching through them real customer/client specific mails becomes tough so fighting email spam is a necessity. To setup spam filter you need to install spamassassin mail filter script and procmail mail filter program in sequence. procmail will scan all incoming mails and use spamassassin to find out spam or not.