DEV Community

Samuel John
Samuel John

Posted on • Originally published at dev.to

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.

Top comments (0)