Linux VPS
Install Nginx, PHP and MariaDB (LEMP)
Set up a web server stack for PHP websites on Ubuntu 24.04. · 8 min read
1. Install packages
apt update
apt -y install nginx mariadb-server php-fpm php-mysql php-curl php-gd php-mbstring php-xml php-zip
2. Secure MariaDB
mysql_secure_installation
3. Create a database
mysql -u root -p
CREATE DATABASE site;
CREATE USER 'site'@'localhost' IDENTIFIED BY 'StrongPassword';
GRANT ALL ON site.* TO 'site'@'localhost';
FLUSH PRIVILEGES;
4. Configure a site
nano /etc/nginx/sites-available/example.comserver {
listen 80;
server_name example.com www.example.com;
root /var/www/example.com;
index index.php index.html;
location / { try_files $uri $uri/ /index.php?$args; }
location ~ \.php$ { include snippets/fastcgi-php.conf; fastcgi_pass unix:/run/php/php8.3-fpm.sock; }
}mkdir -p /var/www/example.com
ln -s /etc/nginx/sites-available/example.com /etc/nginx/sites-enabled/
nginx -t && systemctl reload nginx
5. Add HTTPS
Follow Free SSL with Certbot.
Order a server built by real engineers or talk to our team — we are online 24/7. Support →
Linux VPS
Connect to a Linux VPS via SSHHow to log in to your Linux server from Windows, macOS or Linux.Log in with SSH keys and disable passwordsCreate an SSH key pair, install it on the server and turn off password logins.First 10 minutes on a new Ubuntu/Debian serverUpdate packages, create a sudo user, set the time zone and enable automatic security updates.Install Docker and Docker ComposeRun containers on your KVM VPS with the official Docker packages.