How to Secure phpMyAdmin using Nginx Auth Basic - Golang Web Development

Опубликовано: 28 Сентябрь 2024
на канале: Maharlikans Code
110
7

In this Golang Web Development Series #18, we will learn how to secure phpMyAdmin using the Nginx auth_basic options with step by step guide here in Golang's Web Development Series.

#MaharlikansCode
#GolangWebDevelopment18
#SecurephpMyAdmin
#SecurephpMyAdminUsingNginx
#NginxAuthBasic
#GolangTutorial
#LearnGolangWebDevelopment
#Golang
#LifeAsSoftwareDeveloper
#Maharlikans
#FilipinoSoftwareDeveloper

Get Linode Account:
https://www.linode.com/?r=6aae17162e9...

If you go with extra mile for buying me a cup of coffee, I appreciate it guys: https://ko-fi.com/maharlikanscode

Source Codes:
Step 1: Log in to your Ubuntu server with root privilege:
Step 2: Execute these scripts to check any updates and to install the apache2-utils if not existed from your Ubuntu server.
- sudo apt update
- sudo apt-get install apache2-utils

Step 3: Create your first-time htpasswd file with a new username and password for the authentication with the Nginx auth_basic option:
Execute this for the first time if the .htpasswd file does not exist from /etc/apache2/
- sudo htpasswd -c /etc/apache2/.htpasswd admin

For the succeeding users, just remove the '-c' argument:
- sudo htpasswd /etc/nginx/.htpasswd another_user

Step 4: Configure Nginx to add a new static URL for phpMyAdmin:
location /phpmyadmin/ {
auth_basic "Administrator's Area";
auth_basic_user_file /etc/apache2/.htpasswd;
alias /var/www/html/your_domain.com/public_html/phpmyadmin/;
}

Step 5: Reload your Nginx
- sudo nginx -s reload