August 17, 2026 · by CLIQHOST
A LAMP stack — Linux, Apache, MySQL, PHP — remains one of the most widely used foundations for dynamic web applications. It deploys quickly, is well-documented, and is supported by virtually every PHP CMS or framework. If you've recently set up an SSD VPS and want to turn it into a fully functional web server, this guide walks you through the entire process step by step on Ubuntu 22.04.
Unlike shared hosting, an NVMe VPS or SSD VPS gives you dedicated resources, full root access, and the freedom to install any packages you need. You're not constrained by preset provider configurations — you can fine-tune each component of the stack and host multiple sites or applications on the same server.
sudo privileges)Always start by updating the package list to avoid version conflicts:
sudo apt update && sudo apt upgrade -y
This is especially important on a freshly provisioned server.
Apache is the web server that will handle your HTTP/HTTPS requests.
sudo apt install apache2 -y
Start the service and enable it to launch on boot:
sudo systemctl start apache2
sudo systemctl enable apache2
Check the status:
sudo systemctl status apache2
Open port 80 in the firewall (if UFW is active):
sudo ufw allow 'Apache Full'
Open your server's IP address in a browser — you should see the Apache default test page ("It works!").
💡 To secure traffic with HTTPS, you'll need an SSL certificate. Explore suitable options at CLIQHOST SSL certificates.
MySQL is the relational database management system used by WordPress, Joomla, Magento, and many other platforms.
sudo apt install mysql-server -y
Run the security script to remove anonymous users, the test database, and set a root password:
sudo mysql_secure_installation
Answer Y to all recommended prompts. Then verify the connection:
sudo mysql -u root -p
Create a dedicated database and user for your application:
CREATE DATABASE myapp_db;
CREATE USER 'myapp_user'@'localhost' IDENTIFIED BY 'VeryStr0ngPassword!';
GRANT ALL PRIVILEGES ON myapp_db.* TO 'myapp_user'@'localhost';
FLUSH PRIVILEGES;
EXIT;
⚠️ Never use the MySQL
rootuser for web applications. Always create a dedicated user with the minimum required privileges.
PHP is the scripting language that enables your pages to generate dynamic content.
sudo apt install php libapache2-mod-php php-mysql -y
For compatibility with modern CMS platforms (WordPress, Joomla), install commonly required extensions:
sudo apt install php-curl php-gd php-mbstring php-xml php-xmlrpc php-soap php-intl php-zip -y
Verify the installed version:
php -v
To make Apache prioritise PHP files over HTML, edit the directory configuration:
sudo nano /etc/apache2/mods-enabled/dir.conf
Make sure index.php appears before index.html:
DirectoryIndex index.php index.html index.cgi index.pl index.xhtml index.htm
Restart Apache:
sudo systemctl restart apache2
Create a test file:
sudo nano /var/www/html/info.php
Content:
<?php
phpinfo();
?>
Open http://YOUR_SERVER_IP/info.php in a browser. You'll see a detailed PHP information page. Delete this file after testing — it exposes sensitive server information:
sudo rm /var/www/html/info.php
phpMyAdmin provides a web-based interface for managing MySQL databases without using the command line.
sudo apt install phpmyadmin -y
During installation, select apache2 as the web server. Choose to configure the database with dbconfig-common and set a password for the phpMyAdmin user.
Activate the required PHP extension and restart Apache:
sudo phpenmod mbstring
sudo systemctl restart apache2
Access http://YOUR_SERVER_IP/phpmyadmin and log in with the user you created earlier.
💡 For added security, rename or restrict access to the
/phpmyadminpath using.htaccessrules or Apache configuration.
If you want to host multiple sites on the same VPS or bind a domain, create a VirtualHost:
sudo nano /etc/apache2/sites-available/yourdomain.com.conf
<VirtualHost *:80>
ServerName yourdomain.com
ServerAlias www.yourdomain.com
DocumentRoot /var/www/yourdomain.com
ErrorLog ${APACHE_LOG_DIR}/yourdomain_error.log
CustomLog ${APACHE_LOG_DIR}/yourdomain_access.log combined
</VirtualHost>
Create the site directory:
sudo mkdir -p /var/www/yourdomain.com
sudo chown -R $USER:$USER /var/www/yourdomain.com
Enable the new site and disable the default one:
sudo a2ensite yourdomain.com.conf
sudo a2dissite 000-default.conf
sudo systemctl reload apache2
sudo a2enmod rewrite
sudo systemctl restart apache2
Make sure your VirtualHost includes AllowOverride All to support .htaccess files:
<Directory /var/www/yourdomain.com>
AllowOverride All
</Directory>
Edit /etc/apache2/conf-available/security.conf:
ServerTokens Prod
ServerSignature Off
sudo a2enmod deflate
sudo systemctl restart apache2
Edit /etc/php/8.1/apache2/php.ini (or your PHP version's path) and adjust:
upload_max_filesize = 64M
post_max_size = 64M
memory_limit = 256M
max_execution_time = 120
Restart Apache after each change.
Once your LAMP stack is running, consider these ongoing tasks:
If you'd rather focus on your application and leave server administration to experts, CLIQHOST server management services can handle it all for you.
For high-traffic projects that outgrow a VPS, take a look at managed dedicated servers — dedicated hardware with full management included.
If you prefer shared hosting with a control panel for simpler projects, cPanel shared hosting is a practical starting point.
You've successfully installed and configured a complete LAMP stack on an SSD VPS running Ubuntu 22.04. You now have a solid, flexible platform for hosting PHP applications, WordPress sites, e-commerce stores, or any other dynamic web project.
Ready to get started? Explore SSD VPS and NVMe VPS plans at CLIQHOST — fast infrastructure, modern hardware, and a team ready to help. Have questions? Reach out via our contact page.
Real reviews from customers who trust CLIQHOST for performance, reliability and expert technical support.
"We moved our online shop from a foreign host and the difference is night and day — pages load instantly and support replies in minutes, in Romanian."
"Migrated 12 client sites to CLIQHOST. Free migration, zero downtime, and the cPanel setup is exactly what my team needed. Highly recommend."
"Our NVMe VPS handles traffic spikes without a sweat. Full root, local datacenter, and billing in MDL — everything we wanted from a provider."