LIVE NOW
DartDay - 24 Hours of Blow Out Deals!
00d : 00h : 00m : 00s
Go To the Event

Knowledge Base

Find detailed guides, step-by-step tutorials, and FAQs to help you get the most from your DartNode services.

home web-servers server-setup

How to Set Up a LEMP Stack (Nginx, MySQL, PHP)

How to Set Up a LEMP Stack (Linux, Nginx, MySQL, PHP)

# Install all components
apt update && apt upgrade -y
apt install nginx mysql-server php-fpm php-mysql php-cli php-curl php-xml php-mbstring -y

# Start services
systemctl start nginx mysql php*-fpm
systemctl enable nginx mysql php*-fpm

# Secure MySQL
mysql_secure_installation

Configure Nginx to process PHP — edit /etc/nginx/sites-available/default and add inside the server block:

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

Reload Nginx:

systemctl reload nginx

Test PHP:

echo "<?php phpinfo(); ?>" > /var/www/html/info.php

Visit http://YOUR_SERVER_IP/info.php in your browser. Delete the file after testing:

rm /var/www/html/info.php