How to Install Virtualmin + Nginx on Ubuntu 24.04

Install Virtualmin with Nginx and PHP 8.3 on Ubuntu 24.04 using LEMP mode. Clean, production-ready VPS setup guide.

This guide shows how to install Virtualmin with Nginx on Ubuntu 24.04 using a clean LEMP setup. By preparing the system correctly and using LEMP mode, you’ll get a production-ready server with modern PHP, MariaDB, and Nginx from the start.

Table of Contents

Why Use Virtualmin with Nginx (LEMP Mode)?

Virtualmin supports both Apache and Nginx. Using LEMP mode installs Nginx and PHP-FPM directly, which results in better performance and a cleaner setup.

This approach avoids:

Everything is configured correctly from the beginning.

This is part of our VPS Setup series. See more in Web Server Setup.

Before You Start

Make sure your server is ready:

Update Your System

				
					sudo apt update && sudo apt upgrade -y
				
			

Add PHP Repository (Ondřej)

				
					sudo apt install software-properties-common -y
sudo add-apt-repository ppa:ondrej/php -y
sudo apt update
				
			

This ensures access to modern PHP versions like 8.3 and 8.4.

Add Nginx Repository (Ondřej)

				
					sudo add-apt-repository ppa:ondrej/nginx -y
sudo apt update
				
			

Install Required Tools

				
					sudo apt install wget curl -y
				
			

Download Virtualmin Installer

				
					wget https://software.virtualmin.com/gpl/scripts/install.sh
chmod +x install.sh
				
			

Install Virtualmin with Nginx (LEMP Mode)

				
					sudo sh install.sh -b LEMP
				
			

This installs:

• Virtualmin
• Webmin
• Nginx
• PHP-FPM (from Ondřej repo)
• MariaDB

The installation may take 10–20 minutes.

Install Required PHP Modules (WordPress Ready)

Virtualmin installs PHP, but not all extensions required for WordPress.

Install recommended modules:

				
					sudo apt install php8.3-cli php8.3-fpm php8.3-mysql php8.3-curl php8.3-gd php8.3-mbstring php8.3-xml php8.3-zip php8.3-intl php8.3-bcmath -y
				
			

Restart PHP:

				
					sudo systemctl restart php8.3-fpm
				
			

These modules ensure compatibility with:

• WordPress core
• Plugins and themes
• WooCommerce

Secure MariaDB Installation

Run:

				
					sudo mysql_secure_installation
				
			

Recommended answers:

• Switch to unix_socket authentication → No
• Set root password → Yes
• Remove anonymous users → Yes
• Disallow root login remotely → Yes
• Remove test database → Yes
• Reload privilege tables → Yes

You can now connect using:

				
					sudo mysql -u root -p
				
			

Open Required Firewall Ports (UFW)

If you followed the security guide, your firewall only allows SSH. You now need to open additional ports for Virtualmin and web traffic.

Allow the following:

				
					sudo ufw allow 80
sudo ufw allow 443
sudo ufw allow 10000
				
			

If you changed SSH port earlier (for example to 2222), make sure it is still allowed:

				
					sudo ufw allow 2222
				
			

Reload UFW:

				
					sudo ufw reload
				
			

What These Ports Are For

• 80 (HTTP) → Website traffic
• 443 (HTTPS) → Secure website traffic
• 10000 → Virtualmin/Webmin panel

Without opening port 10000, you won’t be able to access the control panel.

If your firewall is not enabled, you can skip this step. However, it is strongly recommended to keep UFW active.

Complete Post-Installation Wizard

After installation, open your browser and go to:

				
					https://your-server-ip:10000
				
			

If you have a domain pointing to your server, you can also use:

				
					https://yourdomain.com:10000
				
			

You may see a browser warning due to a self-signed SSL certificate. This is normal — proceed to continue.

Login using:

• root user, or
• your sudo user

Complete the Post-Installation Wizard

You will see the Virtualmin Post-Installation Wizard, which configures:

• Memory usage
• MariaDB settings
• Logging
• DNS

You can safely use recommended defaults.

You can complete this using a sudo user. Virtualmin executes system-level tasks internally.

Verify Services

				
					sudo systemctl status nginx
sudo systemctl status mariadb
sudo systemctl status php8.3-fpm
				
			

All services should be running.

Common Issues to Watch For

• Less than 2 GB RAM may cause installation issues
• Firewall blocking port 10000
• Incorrect hostname
• Interrupted installation

If unsure about sizing, review How Much RAM Does a VPS Need.

What This Setup Gives You

After installation, you have:

• Nginx web server
• PHP-FPM with modern PHP
• MariaDB database
• Virtualmin control panel

This is a complete LEMP hosting stack.

What to Do Next

Continue with:

• Virtualmin configuration
• Memory optimization
• Domain setup

Follow: Virtualmin Post-Installation Configuration

Need Help Setting Up Your VPS?

If you’d rather skip the setup and get a fully configured server, I can handle everything for you — from web server installation to performance optimization and security.

Conclusion

Installing Virtualmin with Nginx using LEMP mode provides a clean, efficient, and production-ready VPS setup. With proper repositories and configuration from the start, you avoid common issues and build a solid foundation for hosting.

If you’re following the full setup process, continue here: VPS Setup Beginner’s Guide.

Tharindu

Hey!! I'm Tharindu. I'm from Sri Lanka. I'm a part time freelancer and this is my blog where I write about everything I think might be useful to readers. If you read a tutorial here and want to hire me, contact me here.

Related Articles

Leave a Reply

Your email address will not be published. Required fields are marked *

Back to top button