Download LEMP for Raspberry Pi: Nginx + MariaDB (MySQL) + PHP

LEMP Raspberry Pi

Download latest image: https://sourceforge.net/projects/lemp-raspberry-pi/files/latest/download

Change log

07-16-2014 – After today’s changes RAM usage on first boot is down to <100mb.
07-16-2014 – Set most logs to save to memory instead of SD card. (up to 10M or 1 day max)
07-16-2014 – Reduced system log level from “info” to “warning”. Reduce SD contention.
07-16-2014 – Uninstalled ntpd daemon. Replaced with systemd-timesyncd as per here.
07-16-2014 – Enabled PHP’s mysql, mysqli and pdo extensions. (WordPress tested, it works!)
07-16-2014 – Disabled innodb as per comments here.
07-15-2014 – Switched PHP-FPM to “ondemand” to save RAM.
07-15-2014 – Enabled gzip. Compress level set to 6 to save CPU.
07-14-2014 – Stripped down and optimized Arch Linux OS even more.
07-14-2014 – Updated overclocking. Edit /boot/config.txt to enable recommended overclocking.

 

Software versions

Arch Linux ARM (Rolling release. Use pacman -Syu to check for updates)
Nginx 1.6.0
MariaDB 10.0.12-1
PHP 5.5.14
Zend Opcache 7.0.4-dev

 

LEMP for Raspberry Pi

Turn your Raspberry Pi into a Nginx HTTP server with Arch Linux ARM + Nginx + MariaDB(MySQL) + PHP. Preconfigured and packaged into a downloadable image.

Requirements

  • Raspberry Pi Model B Revision 2.0
  • Power adapter with at least 1.2 A (1.5+ amp recommended)
  • Fat32 formated 2GB SD Card (4GB Recommended)
  • Network Cable for Internet access.

Installation

  • Download the LEMP Raspberry Pi image: arch-lemp-rpi.img.tar.gz
  • Extract it. eg: sudo tar zxf arch-lemp-rpi.img.tar.gz
  • Write extracted image to SD card. eg: sudo dd if=arch-lemp-rpi.img of=/dev/sdb …change sdb if necessary. Don’t run this command if unsure!!!
  • Optional – extend partition to use all of disk. You can use gparted.
  • Plug your internet cable and the LEMP installed SD card into your Raspberry… power it on.

Root access

user: root
pass: root  (please change password! Use passwd command)

MySQL root

user: root
password: changeme

Nginx/PHP web root

/usr/share/nginx/html/

If you are using WiFi instead of network cable to connect to the internet, then use the following command to connect to your SSID:

wifi-menu

To test Nignx simply visit your Raspberry Pi’s IP address from a web browser. You’ll see the standard Nginx test page. You can also test PHP by visiting …your.ip/info.php.

Download LEMP for your Raspberry Pi via SourceForge.net

Here’s a screenshot of top stats after boot…

LEMP raspberry pi - Top Stats

UPDATE 07-16-2014: I’ve removed NTP and replaced with systemd-timesyncd but if you prefer to use ntp simply run: pacman -S ntp

…you may want to switch NTP to a cron task. You can create a cron task by adding a new cron file under /etc/cron.hourly/:

vi /etc/cron.hourly/ntp-update

Contents of that file:

#! /bin/sh
/usr/sbin/ntpdate pool.ntp.org

Make it executable:

chmod +x /etc/cron.hourly/ntp-update

Then disable ntpd:

systemctl stop ntpd
systemctl disable ntpd

To change your timezone follow the instructions here.

This LEMP install is fairly default. Allowing you the opportunity to tweak to your satisfaction. Once you install a MySQL database you may need to edit /etc/mysql/my.cnf as the memory settings I used there might be too restrictive. But be warned, you don’t have much RAM to work with on a Raspberry Pi so don’t change my.cnf unless necessary. Swapping to the SD card would be pretty terrible for performance so I added very little swap and vm.swappiness was changed from 60 to 1. I’ve tested with WordPress 3.9.1 and it works well.

If you would like FTP added please leave in comments.

Also see:

Tags: , , ,



Top ↑