In this video i will guide you on how to Install phpMyAdmin on Ubuntu 22.04. You can use phpMyAdmin to manage your MySQL databases. I have used Nginx webserver in this video. #phpmyadmin #ubuntu #nginx
I have already installed Mysql and Wordpress on this instance.
MySQL Installation: • Install and configure Mysql 8.0.30 on...
Wordpress Installation: • Install Wordpress on Ubuntu [ 22.04 L...
================================================
STEPS:
Update APT Repository:
sudo apt update
Check Installed PHP packages:
php -m
Check PHP, mysql, Nginx Versions:
php -v
mysql --version
nginx -v
Install phpmyadmin and required Packages:
sudo apt install phpmyadmin php-mbstring php-zip php-gd php-json php-curl
Create a symbolic link from the installation files to Nginx’s document root directory:
sudo ln -s /usr/share/phpmyadmin /var/www/codesagar.com/phpmyadmin
NGINX Configurations:
location /phpmyadmin {
root /var/www/codesagar.com;
index index.php index.html index.htm;
location ~ ^/phpmyadmin/(.+\.php)$ {
try_files $uri =404;
root /var/www/codesagar.com;
fastcgi_pass unix:/run/php/php8.1-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include /etc/nginx/fastcgi_params;
}
location ~* ^/phpmyadmin/(.+\.(jpg|jpeg|gif|css|png|js|ico|html|xml|txt))$ {
root /var/www/codesagar.com;
}
}
Check Permissions:
sudo chown -R www-data:www-data /var/www/your_domain/phpmyadmin
sudo chmod -R 755 /var/www/your_domain/phpmyadmin
Restart the nginx and PHP-FPM services:
sudo systemctl restart nginx
sudo systemctl restart php78.1-fpm
Secure PhpMyAdmin
Disabling Root Login
Create a new custom settings file inside the /etc/phpmyadmin/conf.d directory and name it pma_secure.php:
File : pma_secure.php:
Add php tag at start and end of file.
FILE START:
PhpMyAdmin Settings
This should be set to a random string of at least 32 chars
$cfg['blowfish_secret'] = 'CHANGE_THIS_TO_A_STRING_OF_32_RANDOM_CHARACTERS';
$i=0;
$i++;
$cfg['Servers'][$i]['AllowRoot'] = false;
?
FILE END
To generate a truly random string of characters, you can install and use the pwgen program with APT:
sudo apt install pwgen
pwgen -s 32 1
Creating an Authentication Gateway
To create an encrypted password, type:
openssl passwd
Now, create an authentication file.
Location: sudo nano /etc/nginx/pma_pass
File Content:
username:encryptedPassword
Add the following highlighted lines within the location block for phpMyAdmin:
auth_basic "Admin Login";
auth_basic_user_file /etc/nginx/pma_pass;
==============================================================
Topics Covered:
00:00 Install phMyAdmin on ubuntu 22.04
05:15 Disable root Login to Secure phMyAdmin
08:25 Add Authentication gateway to Secure phMyAdmin
if you like this video, please do subscribe now and press the bell icon to get latest video update from #CodeSagar
Link: / @code-sagar
#ec2
#ubuntu
#nginx
#phpmyadmin
#secure
#authentication
#aws
#awstutorial
#mysql
#php
#wordpress