Atlantic.Net Blog

How to Install LEMP In Debian 7

Jose Velazquez
by Atlantic.Net (71posts) under VPS Hosting
Verified and Tested 02/26/15


In this How-To, we will walk you through the LEMP install on your Debian 7 Cloud Server.

LEMP is simply a software bundle that consists of 4 components. L (Linux) the core of the platform which will sustain the other components. E(Nginx)will be used for the web service. M(MySQL)will be used for database management, and P(PHP) will be as the programming language. Making the platform a LEMP.


A cloud server with Debian already installed (which will take care of the L(Linux) aspect of the LEMP install).  If you do not already have a server, why not spin up a Linux Server from Atlantic.Net

Installing LEMP on Debian 7

Install Nginx with the following command to begin the install:

apt-get install nginx

Start nginx with the following command:

service nginx start

Verify if all is working by typing http://YOUR.IP.ADD.RESS

Installing LEMP in Debian-1

Install MySQL with the following command to begin the install and set a MySQL root password:

apt-get install mysql-server

Installing LAMP in Debian-1

Secure MySQL from the default settings with the following command:


Note: You will be prompted with a series of questions. Simply type N for the change root password and Y for yes on all of them, see the screenshot below:

Installing LAMP in Debian-2

Install PHP with the following command to begin the install:

apt-get install php5 php5-fpm php5-mysql

The we must moved the original sites file for backup purposes to a new file name:

mv /etc/nginx/sites-available/default /etc/nginx/sites-available/default.old
nano /etc/nginx/sites-available/default

Copy the following into your text editor:

server {
listen 80;
root /var/www/html;
index index.php index.html index.htm index.nginx-debian.html;

location / {
try_files $uri $uri/ =404;

error_page 404 /404.html;
error_page 500 502 503 504 /50x.html;

location = /50x.html {
root /var/www/html;

location ~ \.php$ {
try_files $uri =404;

fastcgi_pass unix:/var/run/php5-fpm.sock;

fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;

Create a simple PHP page to test by using a text editor of your choice:

nano /var/www/html/info.php

Insert the following code in the empty space then save and exit:


We will need to restart Nginx so all changes are updated.

service nginx restart

Installing LAMP in Debian-3

Congratulations! You have just installed LEMP on your Debian Cloud Server. Thank you for following along in this How-To and check back with us for any new updates.

Get A Free To Use Cloud VPS

Free Tier Includes:
G2.1GB Cloud VPS Free to Use for One Year
50 GB of Block Storage Free to Use for One Year
50 GB of Snapshots Free to Use for One Year

Looking for a Hosting Solution?

We Provide Cloud, Dedicated, & Colocation.

  • Seven Global Data Center Locations.
  • Flexible Private, Public, & Hybrid Hosting.
  • 24x7x365 Security, Support, & Monitoring.
Contact Us Now! Med Tech Award FTC
SOC Audit HIPAA Audit HITECH Audit

Recent Posts

Get started with 12 months of free cloud VPS hosting

Free Tier includes:
G2.1GB Cloud VPS Server Free to Use for One Year
50 GB of Block Storage Free to Use for One Year
50 GB of Snapshots Free to Use for One Year

New York, NY

100 Delawanna Ave, Suite 1

Clifton, NJ 07014

United States

San Francisco, CA

2820 Northwestern Pkwy,

Santa Clara, CA 95051

United States

Dallas, TX

2323 Bryan Street,

Dallas, Texas 75201

United States

Ashburn, VA

1807 Michael Faraday Ct,

Reston, VA 20190

United States

Orlando, FL

440 W Kennedy Blvd, Suite 3

Orlando, FL 32810

United States

Toronto, Canada

20 Pullman Ct, Scarborough,

Ontario M1X 1E4


London, UK

14 Liverpool Road, Slough,

Berkshire SL1 4QZ

United Kingdom