May 28, 2015

LEMP on Debian

^ Ad space to help offset hosting costs :D

Learn how to install & configure Nginx, MySQL and PHP on a Debian server, which has minor differences from the Ubuntu install video.This install process is much like the Ubuntu install of a LEMP stack, minus adding some repositories to get the latest stable Nginx and PHP.

sudo apt-get upate
sudo apt-get install -y tmux wget curl vim htop

Install Nginx/PHP

# See Nginx packages available
sudo apt-cache show nginx

# Install Nginx & PHP
sudo apt-get install -y nginx php5-fpm php5-cli php5-mcrypt php5-gd php5-mysql php5-curl

Configure Nginx

Edit /etc/nginx/sites-available/default to enable it to communicate to PHP:

server {
    listen 80 default_server;
    listen [::]:80 default_server;

    root /var/www/html;

    index index.htm index.html index.php;

    server_name _;

    location / {
        try_files $uri $uri/ /index.php$is_args$args;

    location ~ \.php$ {
        include snippets/fastcgi-php.conf;
        fastcgi_pass unix:/var/run/php5-fpm.sock;

Test that out and then reload Nginx:

sudo service nginx configtest
sudo service nginx reload


Check what version we'll get and install it:

# Check for mysql
sudo apt-cache show mysql-server
sudo apt-get install -y mysql-server

That's it, all done!

All Topics