How to install PHPMyAdmin on Ubuntu 18.04 in Nginx webserver
Written by vaheeD on October 18, 2020
This is done by updating your server’s package index and then using the apt packaging system to pull down the files and install them on your system:
sudo apt update
sudo apt install phpmyadmin php-mbstring php-gettext
For the server selection, choose NONE.
sudo phpenmod mbstring
sudo vi /etc/nginx/conf.d/phpmyadmin.conf
Then paste this code into this file and if you want to change example.com to your domain
server {
listen 81;
listen [::]:81;
server_name example.com;
root /usr/share/phpmyadmin/;
index index.php index.html index.htm index.nginx-debian.html;
access_log /var/log/nginx/phpmyadmin_access.log;
error_log /var/log/nginx/phpmyadmin_error.log;
location / {
try_files $uri $uri/ /index.php;
}
location ~ ^/(doc|sql|setup)/ {
deny all;
}
location ~ \.php$ {
fastcgi_pass unix:/run/php/php7.2-fpm.sock;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
include snippets/fastcgi-php.conf;
}
location ~ /\.ht {
deny all;
}
}
sudo systemctl reload nginx