ssh Useful commands

This is my ssh command reference for AWS – linux – ubuntu – apache2

[1] General Commands
mkdir /var/www/website-name
mv = rename folder

Unzip a file
Go to the location cd /var/www/website-name
Then unzip filename.zip
Remove the zip after extract
rm filename.zip

[2] Give Permission to be able to connect through fileZilla
sudo chown -R www-data:www-data /var/www/my-website
sudo usermod -a -G www-data your-sftp-username
sudo chmod -R 775 /var/www/my-website

[3] Create config file to redirect to the website
Make a copy of default
sudo cp /etc/apache2/sites-available/000-default.conf /etc/apache2/sites-available/website1.conf

Update the conf file
sudo nano /etc/apache2/sites-available/website1.conf
ServerName website2.com
ServerAlias www.website2.com
DocumentRoot /var/www/website2

Enable the new sites with a2ensite:
sudo a2ensite website1.conf

Reload apache
sudo systemctl reload apache2

[4] Install SSL
sudo certbot --apache

Set Up Auto-Renewal
sudo crontab -l

Check Certificates
sudo certbot certificates


Leave a Reply

Your email address will not be published. Required fields are marked *