# deny access to .htaccess files, should an Apache document root conflict with nginx
location ~ /\.ht {
deny all;
}
}
EOF
mkdir -p /var/www/default/public
cat > /var/www/default/public/index.php << "EOF"
<?php
class Application
{
public function __construct()
{
phpinfo();
}
}
$application = new Application();
EOF
rm -rf /var/www/html
usermod -a -G www-data pi
chown -R pi:www-data /var/www
chgrp -R www-data /var/www
chmod -R g+rw /var/www
setfacl -d -R -m g::rw /var/www
apt-get -y autoremove
service nginx restart
service php7.0-fpm restart
# MySQL
apt-get -t stretch -y install mysql-server
read -s -p "Type the password you just entered (MySQL): " mysqlPass
mysql --user="root" --password="$mysqlPass" --database="mysql" --execute="GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '$mysqlPass'; FLUSH PRIVILEGES;"
sed -i 's/^bind-address/#bind-address/' /etc/mysql/mysql.conf.d/mysqld.cnf
sed -i 's/^skip-networking/#skip-networking/' /etc/mysql/mysql.conf.d/mysqld.cnf
service mysql restart
# PhpMyAdmin
read -p "Do you want to install PhpMyAdmin? <y/N> " prompt