Files
nginx-main/setup.sh
2025-12-03 17:09:07 +00:00

17 lines
513 B
Bash
Executable File

#!/bin/bash
# Create a basic authentication file for Nginx
# 1. Check if htpasswd command is available
if ! command -v htpasswd &> /dev/null
then
echo "htpasswd could not be found, please install apache2-utils or httpd-tools."
sudo apt-get update && sudo apt-get install -y apache2-utils
fi
# 2. Create the password file with at least one user
echo "Create an admin user for basic authentication."
htpasswd -c ./data/auth/.htpasswd admin
echo "Basic authentication file created at ./data/auth/.htpasswd"