Rebelz – We have one of Europe’s widest ranges of BJJ & Grappling gear.

www backup script

Here is a simple script that creates a RAR file of /var/www/

1. Create a script folder.
# sudo mkdir /script

2. Create a backup folder and a destnation folder for the www rar file.
# sudo mkdir /backup /backup/www

3. Create a script file.
# sudo nano /script/

Add the following:
/usr/bin/rar a -r /backup/www/www.rar /var/www/

This will will create a rar file of the www directory. The file patch will be /backup/www/www.rar

When done exit Nano and save he script file.

4. Verify that the script file is correct.
# sudo cat /script/

5.  Give the script execution rights.
# sudo chmod +x /script/

6. Instal Cron (Same as schedule tasks in Windows)
# sudo aptitude install cron

7. Edit crontab.
# crontab -e

Add the following t crontab:
15 23 * * * /script/

This means that will start every day 23.15.

8. Verify crontab.
# crontab -l

9. Verify the next day that the backup file exists in /backup/www/.

Run the wwwbackup script manually:
# /script/./

Virtual host config

Virtual hosts in Apache are the same thing as host headers in Windows IIS, allowing the admin to have multiple websites on one webserver with one IP-address.

1. Create a folder for the new virtual host.
# sudo mkdir /var/www/

2. Change owner on the virtual host folder. www-data is the same as IUSR under Windows.
# sudo chown -R www-data /var/www/

3. Edit the Apache configuration file.
# sudo vi /etc/apache2/sites-enabled/000-defualt

4. Add the following text at the end of the file.
<VirtualHost *>
DocumentRoot /var/www/

5. Restart Apache to use the new configuration.
# sudo /etc/init.d/apache2 restart