sudo apt install apache2
sudo systemctl enable apache2
sudo service apache2 status
sudo ufw app list
sudo ufw allow in "Apache Full"
sudo a2enmod rewrite
sudo apt install php php-cli php-fpm php-json php-common php-mysql php-zip php-gd php-mbstring php-curl php-xml php-pear php-bcmath
sudo apt install php libapache2-mod-php php-mysql
https://computingforgeeks.com/how-to-install-php-on-ubuntu/
sudo apt-get install mysql-server
sudo mysql_secure_installation
sudo mysql
SELECT user,authentication_string,plugin,host FROM mysql.user;
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'password';
FLUSH PRIVILEGES;
exit
https://www.digitalocean.com/community/tutorials/how-to-create-a-sudo-user-on-ubuntu-quickstart
adduser username
usermod -aG sudo username
https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/install-LAMP.html
ls -l /var/www
sudo usermod -a -G www-data ec2-user
groups
sudo chown -R ec2-user:www-data /var/www
sudo chmod 2775 /var/www
find /var/www -type d -exec sudo chmod 2775 {} \;
find /var/www -type f -exec sudo chmod 0664 {} \;
Allow override all for /etc/apache2/apache2.conf
Create a file like this as domain.conf
<VirtualHost *:80>
ServerAdmin webmaster@localhost
DocumentRoot /var/www/html/domain
ServerName domain
<Directory /var/www/html/domain>
Options +FollowSymlinks
AllowOverride All
Require all granted
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
Save the file and run:
sudo a2ensite domain
sudo service apache2 restart
sudo apt install certbot python3-certbot-apache
sudo certbot --apache