Nginx on a Raspberry Pi

23 Dec 2013

Prerequisites

Install

$ sudo apt-get install nginx

Setup

$ sudo mkdir /var/www
$ sudo chown www-data:www-data /var/www
$ sudo unlink /etc/nginx/sites-enabled/default
$ sudo emacs /etc/nginx/sites-available/pikan
server {
    listen 80;
    root /var/www;
    index index.html index.htm;

    location /stats {
        stub_status on;
        access_log off;
        allow 127.0.0.1;
        allow 192.168.0.0/24;
        deny all;
    }
}
$ sudo emacs /var/www/index.html
<html>
<head>
<title>pikan.local</title>
</head>
<body>
<h1>Welcome to pikan</h1>
</body>
</html>
$ cd /etc/nginx/sites-enabled
$ sudo ln -s ../sites-available/pikan
$ sudo service nginx start

Test

Browse:

External references