<commit_before>#!/bin/bash
# shellcheck disable=SC1090
echo
echo -e "${YELLOW}--->configuring NGINX $ENDCOLOR"

sudo chmod 755 -R /var/www
sudo chown -R www-data:www-data /var/www
echo "Set the correct folder permissions"

cp "$SCRIPTPATH/utils/nginx/$APPSETTINGS" \
    "/etc/nginx/sites-available/$APPSETTINGS" || \
    { echo -e "${RED}Could not move $APPSETTINGS file.$ENDCOLOR" ; exit 1; }
echo "Copied AtoMiC-ToolKit-configured-sites file over"

sudo sed -i "s@FPMVERSION@$FPMVERSION@g" \
        "/etc/nginx/sites-available/$APPSETTINGS" || \
        { echo -e "${RED}Modifying FPMVERSION in Nginx file failed.$ENDCOLOR"; exit 1; }
echo "Updated config file with correct PHP Version"

sudo sed -i "s@IPADDRESS@$(hostname -I)@g" \
        "/etc/nginx/sites-available/$APPSETTINGS" || \
        { echo -e "${RED}Modifying IPADDRESS in Nginx file failed.$ENDCOLOR"; exit 1; }
echo "Updated config file with current IPAddress"

if [[ ! -L "/etc/nginx/sites-enabled/$APPSETTINGS" ]]; then
    sudo ln -s "/etc/nginx/sites-available/$APPSETTINGS" \
                "/etc/nginx/sites-enabled/$APPSETTINGS"
    echo "Symlinked $APPSETTINGS virtual host"
fi

#COpy over the previous nginx.conf so we get the default settings for the hardware\distro.
cat "$SCRIPTPATH/utils/nginx/nginx.conf" > /etc/nginx/nginx.conf || \
{ echo -e "${RED}Could not update nginx.conf file.$ENDCOLOR" ; exit 1; }<commit_msg>Nginx - Create /var/www if it doesn't exist<commit_after>#!/bin/bash
# shellcheck disable=SC1090
echo
echo -e "${YELLOW}--->configuring NGINX $ENDCOLOR"

if [[ ! -d /var/www ]]; then
    mkdir /var/www
fi

sudo chmod 755 -R /var/www
sudo chown -R www-data:www-data /var/www
echo "Set the correct folder permissions"

cp "$SCRIPTPATH/utils/nginx/$APPSETTINGS" \
    "/etc/nginx/sites-available/$APPSETTINGS" || \
    { echo -e "${RED}Could not move $APPSETTINGS file.$ENDCOLOR" ; exit 1; }
echo "Copied AtoMiC-ToolKit-configured-sites file over"

sudo sed -i "s@FPMVERSION@$FPMVERSION@g" \
        "/etc/nginx/sites-available/$APPSETTINGS" || \
        { echo -e "${RED}Modifying FPMVERSION in Nginx file failed.$ENDCOLOR"; exit 1; }
echo "Updated config file with correct PHP Version"

sudo sed -i "s@IPADDRESS@$(hostname -I)@g" \
        "/etc/nginx/sites-available/$APPSETTINGS" || \
        { echo -e "${RED}Modifying IPADDRESS in Nginx file failed.$ENDCOLOR"; exit 1; }
echo "Updated config file with current IPAddress"

if [[ ! -L "/etc/nginx/sites-enabled/$APPSETTINGS" ]]; then
    sudo ln -s "/etc/nginx/sites-available/$APPSETTINGS" \
                "/etc/nginx/sites-enabled/$APPSETTINGS"
    echo "Symlinked $APPSETTINGS virtual host"
fi

#COpy over the previous nginx.conf so we get the default settings for the hardware\distro.
cat "$SCRIPTPATH/utils/nginx/nginx.conf" > /etc/nginx/nginx.conf || \
{ echo -e "${RED}Could not update nginx.conf file.$ENDCOLOR" ; exit 1; }
{'fraction_non_alphanumeric': 0.14726264726264726, 'fraction_numerical': 0.007623007623007623, 'mean_word_length': 3.462132921174652, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 6, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4924393', 'n_tokens_mistral': 1049, 'n_tokens_neox': 1027, 'n_words': 271}