From 1f300058d74fc1009065c1e9fe8bcddc7186e974 Mon Sep 17 00:00:00 2001 From: Arnaud Lier Date: Mon, 1 Apr 2024 06:34:46 +0000 Subject: [PATCH] Add Installing phpMyAdmin --- Installing-phpMyAdmin.md | 100 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 100 insertions(+) create mode 100644 Installing-phpMyAdmin.md diff --git a/Installing-phpMyAdmin.md b/Installing-phpMyAdmin.md new file mode 100644 index 0000000..06d1ff4 --- /dev/null +++ b/Installing-phpMyAdmin.md @@ -0,0 +1,100 @@ +# Prerequisites + +For the sake of this tutorial, we will assume that NGINX and Certbot are already configured and installed. If this is not the case, here are some tutorials that may help you from other sources: + +- [NGINX Installation](https://www.nginx.com/resources/wiki/start/topics/tutorials/install/) +- [Certbot Installation](https://certbot.eff.org/) + +# Obtaining a Certificate for your phpMyAdmin domain + +First of all, we are going to make sure NGINX is off while we obtain the certificate. We are going to do this by executing this command: + +``` +systemctl stop nginx +``` + +Second of all, we are going to obtain the certbot certificate. + +``` +certbot certonly +``` + +This will now appear with 3 options, you will want to select option that says own webserver. + +Next, it will ask you for your domain. + +# Installing phpMyAdmin + +### Ubuntu and Debian : + +``` +mkdir /var/www/phpmyadmin + +cd /var/www/phpmyadmin + +wget https://files.phpmyadmin.net/phpMyAdmin/5.2.1/phpMyAdmin-5.2.1-all-languages.zip + +unzip phpMyAdmin-5.2.1-all-languages.zip + +cd phpMyAdmin-5.2.1-all-languages + +mv * /var/www/phpmyadmin + +cd /var/www/phpmyadmin + +rm -rf phpMyAdmin-5.2.0-all-languages +``` + +Now that we have installed phpMyAdmin we are going to setup the phpMyAdmin nginx configuration file. Execute these commands : + +``` +nano /etc/nginx/sites-available/phpmyadmin.conf +``` + +Then copy and paste the code below, but please replace the sections with your domain | ```EG. phpmyadmin.lunashosting.online``` + +``` +server { + listen 80; + server_name ; + return 301 https://$server_name$request_uri; +} + +server { + listen 443 ssl http2; + server_name ; + + root /var/www/phpmyadmin; + index index.php; + + location / { + try_files $uri $uri/ =404; + } + + location ~ .php$ { + include snippets/fastcgi-php.conf; + fastcgi_pass unix:/run/php/php8.1-fpm.sock; + } + + ssl_certificate /etc/letsencrypt/live//fullchain.pem; + ssl_certificate_key /etc/letsencrypt/live//privkey.pem; + ssl_session_cache shared:SSL:10m; + ssl_protocols TLSv1.2 TLSv1.3; +} +``` + +**⚠️ Warning ⚠️** + +This configuration will work if you are using PHP 8.1, replace the line `fastcgi_pass` with the PHP version installed on your system. + +Once we have done that we are going to execute the following commands to finish the installation! + +``` +ln -s /etc/nginx/sites-available/phpmyadmin.conf /etc/nginx/sites-enabled/phpmyadmin.conf +``` + +``` +systemctl restart nginx +``` + +phpMyAdmin is now fully configured. You can use it perfectly at the domain you have set! Please make sure to remember to use `https` instead of `http`! \ No newline at end of file