DEV Community

Samuel John
Samuel John

Posted on • Originally published at dev.to

1

How to setup PHPMyAdmin with Nginx on Ubuntu

What is PHPMyAdmin? It is an open source tool written in the PHP programming language and it is useful for handling the administration of MySQL/MariaDB database servers over the Web. It possess a simple interface that is easy to navigate and learn quickly.

What is Nginx? Nginx is an open source software that is used mainly as a web server, reverse proxy, cache server. It is also used as a load balancer, for media streaming, etc.

Now to the topic of discussion for today...
How do I setup PHPMyAdmin with nginx on my ubuntu server?

Step 1: Install needed tools

Before installing PHPMyAdmin, make sure you have installed and configured mysql/mariadb and nginx

sudo apt update && sudo apt upgrade
sudo apt install zip
mkdir -p /var/www/phpmyadmin
cd /var/www/phpmyadmin
wget https://www.phpmyadmin.net/downloads/phpMyAdmin-latest-all-languages.zip
unzip phpMyAdmin-latest-all-languages.zip
cp -a phpMyAdmin-5.2.1-all-languages/. .
rm -rf phpMyAdmin-5.2.1-all-languages
rm -rf phpMyAdmin-5.2.1-all-languages.zip
Enter fullscreen mode Exit fullscreen mode

Step 2: Configure Nginx virtualhost

sudo vim /etc/nginx/conf.d/vhost.conf
server {
    listen         80 default_server;
    listen         [::]:80 default_server;
    server_name    _;
    root           /var/www/phpmyadmin;
    index          index.php;

    location / {
      #try_files $uri $uri/ =404;
      try_files $uri $uri/ /index.php?$args;        
    }

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

    location ~ /\.ht {
      deny all;
    }

    location /phpmyadmin {
      alias /var/www/phpmyadmin;
      #try_files $uri $uri/;

      location ~ \.php$ {
        include snippets/fastcgi-php.conf;
        fastcgi_pass unix:/run/php/php7.2-fpm.sock;
        include fastcgi_params;                       
        fastcgi_param SCRIPT_FILENAME $request_filename;
        #fastcgi_intercept_errors on;
      }
    }
}
Enter fullscreen mode Exit fullscreen mode

Step 3: Test your PHPMyAdmin installation

Go to this url to test: http{s}://your-url/phpmyadmin

Thank you so much for your time. Make sure to check back on my blog for other amazing technical contents.

Image of Stellar post

How a Hackathon Win Led to My Startup Getting Funded

In this episode, you'll see:

  • The hackathon wins that sparked the journey.
  • The moment José and Joseph decided to go all-in.
  • Building a working prototype on Stellar.
  • Using the PassKeys feature of Soroban.
  • Getting funded via the Stellar Community Fund.

Watch the video 🎥

Top comments (0)

AI Agent image

How to Build an AI Agent with Semantic Kernel (and More!)

Join Developer Advocate Luce Carter for a hands-on tutorial on building an AI-powered dinner recommendation agent. Discover how to integrate Microsoft Semantic Kernel, MongoDB Atlas, C#, and OpenAI for ingredient checks and smart restaurant suggestions.

Watch the video 📺

👋 Kindness is contagious

Dive into this thoughtful article, cherished within the supportive DEV Community. Coders of every background are encouraged to share and grow our collective expertise.

A genuine "thank you" can brighten someone’s day—drop your appreciation in the comments below!

On DEV, sharing knowledge smooths our journey and strengthens our community bonds. Found value here? A quick thank you to the author makes a big difference.

Okay