Installing Nginx with phpMyAdmin on Ubuntu 22.04 Example




Installing Nginx with phpMyAdmin on Ubuntu 22.04 Example

Hi Guys,

This example is focused on How to Install phpMyAdmin with Nginx on Ubuntu 22.04?. In this article, we will implement a Install phpMyAdmin on Ubuntu 22.04 with Nginx. This tutorial will give you simple example of Configuring nginx and phpMyAdmin . you'll learn phpMyAdmin installation on Nginx.

You can use this post for ubuntu 14.04, ubuntu 16.04, ubuntu 18.4, ubuntu 20.04, ubuntu 21 and ubuntu 22.04 versions.

Step 1: Update System Dependencies

The tutorial, it is good to ensure your system is up-to-date with all existing packages to avoid any conflicts during the installation.

$ sudo apt update

Step 2: Install phpMyAdmin

we install phpmyadmin with the following command:

$ sudo apt-get install phpmyadmin

Then, we hit Tab when the prompt asks about bypassing the webserver.

After that, the next prompt will ask whether we want to configure a database for PHPMyAdmin with dbconfig-common’s help.

Step 3: Configure phpMyAdmin with Nginx

Then, we create a symbolic link to the Nginx document root directory from the installation files with the following command:

$ sudo ln -s /usr/share/phpmyadmin /usr/share/nginx/html

After the above process, we have to set up phpMyAdmin as a virtual host as well as a subdomain:

location ~ \.php$ {

try_files $uri =404;

fastcgi_split_path_info ^(.+\.php)(/.+)$;

fastcgi_pass unix:/var/run/php5-fpm.sock;

fastcgi_index index.php;

fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;

include fastcgi_params;


The new file inside the server block from where wish to access phpMyAdmin.

server {

. . .

root /usr/share/nginx/html;

index index.php index.html index.htm;


. . .


Step 4: Restart Web Server

Test the Installation of PHPMyAdmin

$ systemctl restart nginx

Step 5: Restart Web Server

You can now access the web interface by visiting your server’s domain name or public IP address followed by /phpmyadmin: