How to Install phpMyAdmin with Nginx on Ubuntu 18.04

Install phpMyAdmin with Nginx

Introduction: A Beginner’s Guide How to Install phpMyAdmin with Nginx on Ubuntu

phpMyAdmin is a popular web-based database management tool that provides an intuitive interface for managing MySQL databases. If you’re an amateur user looking to install phpMyAdmin with Nginx on Ubuntu, this comprehensive guide will walk you through the process step-by-step. By following these instructions, you’ll have phpMyAdmin up and running, allowing you to easily manage your databases through a user-friendly web interface.

Before you begin the installation process, ensure that you have the following prerequisites in place:

  1. An Ubuntu server (preferably the latest LTS version) with root access or a user with sudo privileges.
  2. Nginx is installed and configured on your server.
  3. MySQL or MariaDB is installed and running on your server.

Now, let’s dive into the installation process.

Step 1: Update System Packages
Start by updating your Ubuntu server’s packages to their latest versions:

sudo apt update
sudo apt upgrade

Step 2: Install phpMyAdmin
phpMyAdmin is available in the official Ubuntu repositories. Use the following command to install it:

sudo apt install phpmyadmin

During the installation, you’ll be prompted to select the web server that should be automatically configured to run phpMyAdmin. Choose “nginx” using the spacebar, and then press Enter to continue.

When asked to configure the database for phpMyAdmin, select “No” since you’ll be configuring it manually in the next step.

Step 3: Configure Nginx for phpMyAdmin
Create a new Nginx server block configuration file for phpMyAdmin:

sudo nano /etc/nginx/conf.d/phpmyadmin.conf

Add the following content to the file:

server {
    listen 80;
    server_name your_domain_or_ip;

    location / {
        root /usr/share/phpmyadmin;
        index index.php;

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

Replace “your_domain_or_ip” with your server’s domain name or IP address.

Save the file and exit the text editor.

Step 4: Configure phpMyAdmin
Edit the phpMyAdmin configuration file:

sudo nano /etc/phpmyadmin/config.inc.php

Find the line that starts with $cfg['Servers'][$i]['host'] and update it to reflect your MySQL or MariaDB server’s address (e.g., ‘localhost’ or an IP address).

Save the file and exit the text editor.

Step 5: Restart Nginx and PHP-FPM
Restart Nginx and PHP-FPM to apply the changes:

sudo systemctl restart nginx
sudo systemctl restart php7.4-fpm

Step 6: Access phpMyAdmin
You can now access phpMyAdmin by visiting your server’s domain name or IP address in your web browser:


Log in with your MySQL or MariaDB credentials, and you’ll be greeted with the phpMyAdmin interface to manage your databases.


Congratulations! You have successfully installed phpMyAdmin with Nginx on your Ubuntu server. By following the steps outlined in this guide, you can now easily manage your MySQL or MariaDB databases through the user-friendly phpMyAdmin web interface. Explore the various features and tools offered by phpMyAdmin to streamline your database management tasks and enhance your productivity.

Useful Links for Reference:

  1. phpMyAdmin Official Website: https://www.phpmyadmin.net/
  1. Nginx Official Website: https://nginx.org/
  2. Ubuntu Official Website: https://ubuntu.com/
  3. MySQL Official Website: https://www.mysql.com/
  4. MariaDB Official Website: https://mariadb.org/

About Author

Pavlos Papadopoulos Avatar

Discover more from Gadget Rumours

Subscribe to get the latest posts to your email.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Recent Posts

Discover more from Gadget Rumours

Subscribe now to keep reading and get access to the full archive.

Continue reading