Raspberry Pi, ready to serve !

Alright. My Raspberry Pi by is set up and delivering AirPrint and AirPlay services.
Let’s add few web capabilities.

 
A lightweight configuration: Nginx & SQLite

I felt like the usual Apache / MySQL duet might be a little to heavy for my tiny ApplePie. So, I opted for a Nginx / SQLite couple.

Everything is already packaged, thus, the installation is rather straighforward:

1
2
3
4
5
6
7
8
9
10
apt-get install nginx 
apt-get install php5-fpm php5-cgi php5-cli php5-common
apt-get install php-pear php5-gd php5-imagick php5-mcrypt php5-memcache php5-sqlite
apt-get install sqlite3
useradd www-data
groupadd www-data 
usermod -g www-data www-data 
mkdir /var/www 
chmod 775 /var/www -R 
chown www-data:www-data /var/www

Its time to modify php.ini :

cgi.fix_pathinfo = 0;

… and to configure Nginx default site (/etc/nginx/sites-enables/default):

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
upstream php {
        server unix:/var/run/php5-fpm.sock;
}
 
server {
 
        root /var/www;
        listen          80;
        server_name     applepie;
 
        access_log      /var/log/nginx/access.log;
        error_log       /var/log/nginx/error.log;
 
        index index.html index.php;
 
        location = /favicon.ico {
                log_not_found off;
                access_log off;
        }
 
        location / {
                try_files $uri $uri/ /index.php;
        }
        location ~ \.php$ {
                include fastcgi_params;
                fastcgi_intercept_errors on;
                fastcgi_pass php;
        }
 
        location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ {
                expires max;
                log_not_found off;
        }
}

Let’s fire up the Nginx:

service nginx start

… and check that everything is working nicely:

The Raspberry Pi is now ready to serve :p

I guess, I have no reason left not to finish my cooking iOS app know …

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.