Chapter 9: The Pi as a Web Server
Although the Pi is significantly less powerful than most devices you would find in a data centre, that doesn’t mean that it can’t act as a useful server in a home or business environment. Despite a small amount of memory and relatively underpowered processor, the Pi’s low power draw and silent running makes it a great choice for serving low-traffic simple pages to a local network or even out onto the Internet.
A large proportion of modern web servers run a combination of Linux, Apache, MySQL and PHP—commonly referred to as a LAMP stack. Linux provides the underlying operating system; MySQL the database back-end; Apache the web server; and PHP a scripting language for dynamic pages. Using a LAMP-based server, you can run some quite complex packages ranging from content management systems like WordPress to interactive forums like phpBB. All of this is possible with the Raspberry Pi, so long as you don’t expect performance similar to that of a powerful commercial server.
Web servers work best with plenty of memory. To ensure maximum performance, switch the Pi’s memory partitioning to a 224/32 MB split (see Chapter 6, “Configuring the Raspberry Pi”) and don’t run a graphical user interface (GUI) at the same time.
Installing a LAMP Stack
If you’re running the recommended Debian distribution for the Raspberry Pi, you’re already one-quarter of the way ...