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.
The steps are as follows:
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.
Step 1 : Install Nginx
sudo apt update sudo apt install nginx
Step 2 : install MySQL
sudo apt install mysql-server
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.