Add Installing phpMyAdmin
parent
b2447a11b6
commit
1f300058d7
1 changed files with 100 additions and 0 deletions
100
Installing-phpMyAdmin.md
Normal file
100
Installing-phpMyAdmin.md
Normal file
|
@ -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 <domain> sections with your domain | ```EG. phpmyadmin.lunashosting.online```
|
||||||
|
|
||||||
|
```
|
||||||
|
server {
|
||||||
|
listen 80;
|
||||||
|
server_name <domain>;
|
||||||
|
return 301 https://$server_name$request_uri;
|
||||||
|
}
|
||||||
|
|
||||||
|
server {
|
||||||
|
listen 443 ssl http2;
|
||||||
|
server_name <domain>;
|
||||||
|
|
||||||
|
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/<domain>/fullchain.pem;
|
||||||
|
ssl_certificate_key /etc/letsencrypt/live/<domain>/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`!
|
Loading…
Reference in a new issue