RPi Nginx Webserver

From eLinux.org
Revision as of 11:57, 4 July 2012 by Rickb (talk | contribs) (first draft)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Introduction

Using the Pi as a webserver is easy. There is more than enough grunt to run a small web server supported by php and mysql.

This HOWTO is based on the Debian build.

Why Nginx?

By far the most of the world's websites are hosted on Apache. If your Pi runs Debian, you could install Apache just using the normal "sudo apt-get install apache2", and the hard work would be done for you. However, the result may be less than satisfactory because Apache is intended to run on full-sized servers and is a bit of a hog on resources.

However, there are several good light-weight alternatives: RPi webserver covers installing Lighttpd, but a far more widely-used server is Nginx (additional resources). You can find plenty of resources comparing these two and others so I won't repeat the factors here to help you decide.

There is a hitch with Nginx: unfortunately, the Debian repositories only hold an old version of it. Fortunately, this isn't a problem because building it from source is easy. And here's how.

Nginx Installation

Using Nginx for Static Content

Nginx with PHP