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

LEMP Raspberry Pi

Download latest image:

change log

07-16-2014 – After today’s changes RAM usage on first boot is reduced to <100mb.
07-16-2014 – Set most logs to be saved in memory instead of SD card. (max 10M or up to 1 day)
07-16-2014 – Lowered the system log level from “Information” to “Warning”. Reduce SD contention.
07-16-2014 – Uninstalled the ntpd daemon. replaced with systemd-timesyncd According to 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 – Enable gzip. Set compress level to 6 to save CPU.
07-14-2014 – Arch Linux OS has been deprecated and optimized even further.
07-14-2014 – Updated overclocking. Edit /boot/config.txt to enable recommended overclocking,

software version

Arch Linux ARM (rolling release. Use pacman -Syu 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

Transform your Raspberry Pi into an Nginx HTTP Server with Arch Linux ARM + Nginx + MariaDB (MySQL) + PHP. Pre-configured and packaged in a downloadable image.

Requirements

  • Raspberry Pi Model B Revision 2.0
  • Power adapter with at least 1.2 A (1.5+ amp recommended)
  • Fat32 built in 2GB SD card (4GB recommended)
  • Network cable for Internet access.

installation

  • Download LEMP Raspberry Pi Image: Arch-lemp-rpi.img.tar.gz
  • Remove it. Example: sudo tar zxf arch-lemp-rpi.img.tar.gz
  • Write extracted image to SD card. Example: sudo dd if=arch-lemp-rpi.img of=/dev/sdb … Change sdb if necessary. Do not run this command when unsure!!!
  • Optional – Extend partition to use all disks. You can use gparted.
  • Plug your internet cable and LEMP installed SD card into your Raspberry… turn it on.

basic entry

user:root
pass: root (Please change the password! Use Password Permission)

MySQL Root

user:root
Password: changeme

Nginx/PHP Web Root

/usr/share/nginx/html/

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

wifi-menu

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

Here is a screenshot of the top stats after boot…

LEMP Raspberry Pi - Top Stats

Update 07-16-2014: I have removed ntp and replaced with systemd-timesyncd But if you prefer to use ntp just run: pacman-s ntp

… you may want to convert ntp to 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

Follow the instructions to change your time zone Here,

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

If you want FTP to be added please leave it in the comments.

See more:

Leave a Comment