The Rasp Pi serves up a tempting web server

Tips and Tricks

Now that you have a fully functional web server that can run scripts and serve web pages, you can indulge in a lot of powerful programming with this tiny device. As time goes on and your web server continues to function well, you might want to look around for performance tweaks and added functionality.

A few simple alterations that come to mind are making backups with rsync [11], or using packages like Heartbeat for IP failover [12]. Rsync can make backups on another Linux machine, whereas IP failover allows another Raspberry Pi or Linux PC to take over if Apache goes down on the main node. Rsync is very simple to use and set up, but inexperienced users may find creating IP failover more difficult and time consuming. If you install rsync on your Rasp Pi web server and set up SSH keys so you can automatically connect to a backup Rasp Pi, you can run a one-line command to back up files:

# ssh-keygen

To do so, move the file .ssh/ to the backup machine and call it authorized_keys. Then, make sure authorized_keys read and write (0600) permissions:

# chmod 600 authorized_keys

To back up files from the /var/www/ folder to the /home/pi/backups/ folder on another machine that exists on the home network, enter

# rsync -avz /var/www/ pi@

In this case, the backup device is another Raspberry Pi connected to the same router.

Basic Rankings

Just like a website hosted by a large web hosting company, your home-based website can be submitted to and crawled by search engines like Google. After you have submitted the site, you can create an XML sitemap and submit it to Google Webmaster Tools [13].

Your site should have keyword-targeted web pages [14], good page titles, and adequate internal and external links to subject-appropriate websites.

Buy this article as PDF

Express-Checkout as PDF

Pages: 8

Price $2.95
(incl. VAT)

Buy Raspberry Pi Geek

Get it on Google Play

US / Canada

Get it on Google Play

UK / Australia

Related content