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/id_rsa.pub
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@192.168.0.115:/home/pi/backups/
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.
Infos
- PHP safe mode: http://us3.php.net/manual/en/features.safe-mode.php#ini.safe-mode
- PuTTY: http://raspberrypi4dummies.wordpress.com/2013/03/17/connect-to-the-raspberry-pi-via-ssh-putty/
- Nano text editor basics: http://www.raspberry-pi-geek.com/howto/Nano-Text-Editor-Basics
- No-IP: http://www.noip.com
- Varnish Cache: https://www.varnish-cache.org
- Minification: http://en.wikipedia.org/wiki/Minification_(programming)
- Free CSS templates: http://www.freecsstemplates.org
- mod_expires: http://httpd.apache.org/docs/2.2/mod/mod_expires.html
- MIME types: http://reference.sitepoint.com/html/mime-types-full
- YSlow: http://yslow.org/user-guide/
- rsync: http://rsync.samba.org
- Heartbeat: http://www.weedpi.com/how-to/how-to-create-a-pi-cluster/
- Google Webmaster Tools: http://www.google.com/webmasters/tools/
- Keyword targeting: http://blog.hubspot.com/blog/tabid/6307/bid/6223/Keyword-Targeting-The-Essential-Guide-for-Website-Owners.aspx
Buy this article as PDF
Pages: 8
(incl. VAT)