3d. Forwarding Mails
Ever wondered how to forward your mails especially if you are a webmaster managing number of sites. You might need to forward any email sent to your primary email address. Its that easy. Just create a .forward file on your home directory. Insert list of emails addresses separated by commas, where you want to get forwarded.
Login as user and type
echo 'destination_email_address' > .forward
or you can use
nano to create .forward file. Just
Delete .forward file if you dont want any forwarding.
Installing Squirrel Web Mail
Squirrel mail is one of the most popular web based email with very friendly interface. Squirrel mail works without mysql database very easy to install and configure under apache2..
Note: It is recommended to have
apache and php installed before you install squirrelmail.
apt-get install squirrelmail
Squirrelmail configuration file is located in:
/etc/squirrelmail/ folder. By default all settings are preloaded.
# Run squirrelmail configuration utility as ROOT
/usr/sbin/squirrelmail-configure
Now we want to
setup to run under apache. Edit apache configuration file
/etc/apache2/apache2.conf and insert the following line:
Include /etc/squirrelmail/apache.conf
Thats it. Your webmail is ready !!!.
Point your browser to:
http://yourdomain/squirrelmail
Create a separate local user and login as a new user.
DO NOT LOGIN AS ROOT AND YOU WILL GET "ERROR: CONNECTION DROPPED"
Mail Server Problems in Logs
Always refer to logs located in
/var/log/mail.log so that you can identify what the problem is before you can troubleshoot.
4. Webmin - Server Control Panel
Webmin is a nice server control panel available free of charge. It is similar like cpanel or plesk to manage your server.
Download the latest version of webmin from the main site
wget
http://downloadpath/webmin-x.x.xx.tar.gz
tar xzf webmin-x.x.x.tar.gz
cd /webmin-x.x.x
./setup.sh
The installation program will ask series of questions and most values will be automatically set by default.
Once done, point your browser to:
http://ip.address:10000 or
http://www.domainname:10000
Login into your webmin and you can do almost anything with your server.
5. Webalizer Installation
Webalizer is a visitor statistics software shows you nice graphic based on visitors, hits and pageviews of your site. It is indeed very easy to configure and run webalizer under apache. Webalizer runs as a daily cron job to monitor your server stats.
apt-get install webalizer
Now edit the webalizer configuration file located at: /etc/webalizer.conf and locate a line with LogFile /var/log/apache/access.log.1 and change to the correct name access.log as shown below.
LogFile /var/log/apache2/access.log
and the bin of webalizer is located at /usr/bin/webalizer which is automatically scheduled to run daily as cron job.
To run webalizer manually.
/usr/bin/webalizer
Point your browser to
http://domain/webalizer and you must see some pretty nice visitor statistics of your site.
6. Installing FTP Server (VSFTP)
You will need a simple ftp server to upload and download your web files. i specially like vsftp server because not only it is very easy to configure but also runs faster than other ftp peers with good connection speed.
apt-get install vsftpd
Configuration file is located at:
/etc/vsftpd.conf
Change the following settings in
/etc/vsftpd.conf so that you allow local users and allow write using ftp.
# Uncomment this to allow local users to log in.
local_enable=YES
# Uncomment this to enable any form of FTP write command.
write_enable=YES
Before you connect using ftp client, you will need to create local users and group. Do not upload files using root.
# CD to /home/<user> and create a symbolic link to /var/www as this is the public html folder.
ln -s /var/www www
#change ownership /var/www to user
chown -R <user> /var/www
#Change to 755 permissions
chmod -R 755 /var/www
Now you can connect to ftp and upload files. Once you upload all necesarry files in the public html folder, make sure all the files have 755 permission as otherwise you will get permission denied/forbidden error from apache.
Enabling VSFTP to Show Dotted Files
By default, vsftp does not show dotted files in the server, especially .htaccess, eventhough you have successfully uploaded the files. This could be frustrating especially if you are using .htaccess for authentication or rewriting friendly URLs. To fix this just add
force_dot_files=YES in your vsftp configuration file
/etc/vsftpd.conf
# Activate directory messages - messages given to remote users when they
# go into a certain directory.
dirmessage_enable=YES
force_dot_files=YES
Restart the vsftp server
/etc/init.d/vsftpd restart.
Webmin Package: VSFTP also available as
webmin package. You can easily change settings from webmin for vsftp.
7. ClamAV - Antivirus Software
Linux based systems are often vulnerable to trojans, worms and viruses. It is often to be on the safer side to scan your server using freely available ClamAV antivirus available for linux
apt-get install clamav
To scan necessary files
clamscan -R /folders
-R is recursive and is optional
To update virus database:
freshclam
Running as Cron Daily Job
To run antivirus as a cron job (automatically scan daily) just run
crontab -e from your command line. Then add the following line and save the file.
02 1 * * * root clamscan -R /var/www
This will run the cron job daily @ 1.02 AM by scanning the public html. You can change the folder to whatever you want for mail etc.
8. Quick IP Tables Firewall
Without firewall there is no absolute security for your server. Atleast i would recommend a simple firewall that would employ packet filtering and block off unnecessary ports in your server using IP tables.
apt-get install iptables
I found
Quick n Dirty Firewall pretty interesting. You can copy and run the shell script to set up your quick firewall.
Remember not to block important ports like
21 (ftp)
22 (SSH)
23 (Telnet)
25 110 (email)
443 (SSL http or https)
993 (imap ssl)
995 (pop3 ssl)
10000 (webmin)
80 (http)
9. PHP*MySQL*Apache Server Kits
Xampp Server for Windows/Linux -
apache friends - very easy apache, mysql, php and perl installation without hassles
ApachePHPMySQL Project -
SourceForge.net: ApachePHPMySQL
WAMP Server -
Install PHP 5 Apache MySQL on Windows : WampServer
Easy PHP Server -
http://www.easyphp.org/
AppServ Server Kit -
AppServNetwork
10. Useful Reference
Debian Help -
http://www.debianhelp.co.uk
VPS Link Resources:
http://wiki.vpslink.com
DNS Setup:
Setup your Own Name Server with Directadmin
Article:
Implementing PHP File Upload Security
Article:
Install APF Firewall in Linux Servers