WordPress Installation Tutorial

How set-up WordPress on a RasPi using the lighttpd webserver

Once I had my webcam and sensors attached to my Pi, I wanted to make them both accessible through the web. Although the Apache HTTP server is most popular and provides a lot of features, it consumes quite a lot of resources and is probably not the best choice for the Raspi. For installation of lighttpd on Debian wheezy just do:

$ apt-get install lighttpd php5-cgi

Dependencies will be installed automatically. After installation, customize the server by editing /etc/lighttpd/lighttpd.conf. Here we enable some modules for compression and caching to speed-up page loading.

server.modules = (
        "mod_redirect",
        "mod_alias",
        "mod_access",
        #"mod_fastcgi",
        "mod_compress",
        "mod_rewrite",
        "mod_expire"
)

server.document-root        = "/var/www"
server.upload-dirs          = ( "/var/cache/lighttpd/uploads" )
server.errorlog             = "/var/log/lighttpd/error.log"
server.pid-file             = "/var/run/lighttpd.pid"
server.username             = "www-data"
server.groupname            = "www-data"
server.port                 = 80
fastcgi.server              = (".php" =>(("bin-path"=>"/usr/bin/php5-cgi","socket"=>"/tmp/php.socket")))

index-file.names            = ( "index.php", "index.html", "index.lighttpd.html" )
url.access-deny             = ( "~", ".inc" )
static-file.exclude-extensions = ( ".pl", ".fcgi" )

$HTTP["url"] =~ ".(jpg|gif|png|css|js|svg)$" { expire.url = ( "" => "access 7 days" )}
etag.use-inode = "enable"
etag.use-mtime = "enable"
etag.use-size = "enable"
static-file.etags = "enable"

# default listening port for IPv6 falls back to the IPv4 port
include_shell "/usr/share/lighttpd/use-ipv6.pl " + server.port
include_shell "/usr/share/lighttpd/create-mime.assign.pl"
include_shell "/usr/share/lighttpd/include-conf-enabled.pl"

compress.cache-dir          = "/var/cache/lighttpd/compress/"
compress.filetype           = ("text/xml","application/x-javascript", , "application/javascript", "text/javascript", "te
xt/x-js", "text/css", "text/html", "text/plain", "image/png", "image/gif", "image/jpg", "image/svg+xml", "application/xm
l")

Next you should edit your /etc/php5/cgi/php.ini, search and uncomment the lines

;fix_pathinfo=1
;output_compression=On

by removing the colon. Now make sure that the cache directories are available by doing

$ sudo mkdir /var/cache/lighttpd/compress/
$ sudo chown www-data:www-data /var/cache/lighttpd/compress/

Now its time to restart the server with

$ sudo service lighttpd restart

To make your server accessible  from the outer world its required to open up port 80 on your router. If you’re on a dial-up network without a fixed IP address, you also have to set-up a Dyn-DNS and domain name, so that your page can be found under http://www.my-bloody-webpage.com.