#!/bin/bash

# Icons
# To get back icons in index pages run next command:

sudo apk add apache2-icons

# Title length
# To unlimite displayed file name's length add next lines in `/etc/apache2/httpd.conf` file:

echo "IndexOptions NameWidth=*" >> /etc/apache2/httpd.conf

# Basic auth
# Install `apache2-utils` and create file for passwords with first user:

apk add apache2-utils
htpasswd -c /etc/apache2/.htpasswd user_name

# Or without `-c` to add one more user. Because `-c` rewrite entiry file.
# Then add this to your `/etc/apache2/conf.d/example.conf` file:

echo "
<Directory "/var/www/localhost/htdocs/private">
    AuthType Basic
    AuthName "Restricted Area"
    AuthBasicProvider file
    AuthUserFile "/etc/apache2/.htpasswd"
    Require user user_name
</Directory>" >> /etc/apache2/conf.d/example.conf

# see also:
# - https://httpd.apache.org/docs/2.4/howto/auth.html
# - https://www.howtogeek.com/devops/how-to-setup-basic-http-authentication-on-apache/
