Instant Server Setup - phpMyAdmin with Nginx on an Ubuntu 20.04 Server
Lets Try
. 2 min read
This process involves installing and configuring a web server (Nginx) along with a database management system (MySQL) and a popular PHP application (phpMyAdmin) on an Ubuntu 20.04 server.

how To Install and Secure phpMyAdmin with Nginx on an Ubuntu 20.04 Server
The steps are as follows:
- Update the package list: This command makes sure that your system has access to the latest versions of software packages.
- Install Nginx: Nginx is a web server software that can handle high traffic websites. It's a popular alternative to Apache.
- Install MySQL server: MySQL is a widely-used relational database management system that stores and manages data.
- Install PHP and required modules: PHP is a server-side scripting language used to create dynamic web content. The packages being installed here add support for common PHP features like database connectivity and XML parsing.
- Install phpMyAdmin: phpMyAdmin is a popular web-based application used to manage MySQL databases. here we will try to install phpMyAdmin package directly by downloading package from source.
- Configure Nginx to work with PHP: This step tells Nginx how to handle PHP scripts. It configures Nginx to pass PHP scripts to the PHP FastCGI Process Manager (FPM) for execution.
Restart Nginx to apply the changes: Restarting the Nginx service applies the configuration changes made.
After completing all these steps, you should be able to access phpMyAdmin by visiting http://your_server_ip/phpmyadmin in your web browser.
All commands are well tested.
Get a Server from Top Cloud Server Providers
- DigitalOcean.com - Get $100 Credit Free for 60 days
- hetzner.cloud - Get €20 Credit Free ( cheapest)
- vultr.com - Get $100 Credit Free
Step 1 : Install Nginx
sudo apt update sudo apt install nginx
Step 2 : install MySQL
sudo apt install mysql-server
- setting MySQL root user password to login in phpMyadmin
sudo mysql ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'newpassword'; FLUSH PRIVILEGES;
next time to login again in MySQL using command line use this command:
sudo mysql -u root -p
Step 3 : install php 8.0 and modules
sudo add-apt-repository ppa:ondrej/php sudo apt-get update sudo apt install php8.0-fpm sudo apt install php8.0-intl sudo apt install php8.0-mbstring sudo apt-get install -y php8.0-cli php8.0-common php8.0-mysql php8.0-zip php8.0-gd php8.0-mbstring php8.0-curl php8.0-xml php8.0-bcmath sudo service php8.0-fpm restart php -v
Step 4 : installing phpMyadmin
Change Directory to : cd /var/www/html
Download phpMyadmin zip file from official site and unzip them
cd /var/www/html/ wget https://files.phpmyadmin.net/phpMyAdmin/5.2.1/phpMyAdmin-5.2.1-all-languages.zip apt install unzip unzip phpMyAdmin-5.2.1-all-languages.zip
rename the unzipped phpMyAdmin-5.2.1-all-languages
folder to phpmyadmin
and give permission
mv /var/www/html/phpMyAdmin-5.2.1-all-languages /var/www/html/phpmyadmin sudo chown -Rf www-data.www-data /var/www/html/phpmyadmin/
setting up phpMyAdmin secret passphrase? blowfish_secret
Step 5: change the Nginx default file /etc/nginx/sites-available
with this:
server { listen 80 default_server; listen [::]:80 default_server; root /var/www/html; # Add index.php to the list if you are using PHP index index.php index.html index.htm index.nginx-debian.html; # Your Server ip Address server_name 127.0.0.1; location / { # First attempt to serve request as file, then # as directory, then fall back to displaying a 404. try_files $uri $uri/ =404; } location ~ \.php$ { include snippets/fastcgi-php.conf; fastcgi_pass unix:/run/php/php8.0-fpm.sock; } location ~ /\.ht { deny all; } }
restart the Nginx
sudo systemctl restart nginx
enabling ufw firewalls command
sudo ufw allow 'Nginx HTTP' sudo ufw app info OpenSSH sudo ufw allow 22/tcp sudo ufw allow 80/tcp sudo ufw allow 443/tcp sudo ufw allow 80/udp sudo ufw allow 443/udp sudo ufw allow 22 sudo ufw allow 80 sudo ufw allow 443 sudo ufw allow 25 sudo ufw disable sudo ufw enable sudo ufw status
don't forget to like and subscribe.
More Stories from
Deploy Tailscale in Portainer docker container Raspberry pi
A comprehensive guide on deploying Tailscale through Portainer in Raspberry pi. lets integrate Tailscale into your existing Docker setup.
Nginx Proxy for s3 compatible storage & buckets
Nginx can be used as a reverse proxy for S3 compatible storage and buckets. This is useful in many scenarios, including adding authentication, security or custom routing to S3-compatible solutions.
Window Server 2025 Contabo VPS Install Guide
Window server in contabo is very costly but you can deploy your license key with custom image.
Setting up SSH keys to a Ubuntu Server with Mac
Generating SSH keys on a Mac for use with an Ubuntu server is a straightforward process. Here’s a step-by-step guide: Generate the SSH Key Pair
Git/Github Clone Private Repository on Ubuntu Server 24.04
GitHub is a free platform that provides repository hosting and We will guide you to install Git on Ubuntu 24.04, adding and cloning a repository from GitHub to your Ubuntu VPS server.