Adding Swap to an AWS Lightsail Ubuntu Instance (running WordPress on NGINX)

Installing WordPress on AWS Lightsail Using NGINX (including Let’s Encrypt TLS/SSL): https://youtu.be/PqIQVbErHus

Getting an A+ Rating on Qualys SSL Test for WordPress Install Running on NGINX: https://youtu.be/rvaGJV3Twr8

Check Swap Status
sudo swapon --show
Check Drive Capacity
df -h
Allocate Swap File Space on Drive
sudo fallocate -l 1G /swapfile
Change Permissions of Swap File
sudo chmod 600 /swapfile
Check Swap File Size and Permissions
ls -lh /swapfile
Make Swap File
sudo mkswap /swapfile
Enable Swap
sudo swapon /swapfile
Open fstab for Editing
sudo nano /etc/fstab
/swapfile none swap defaults 0 0
Check Swap Parameters
cat /proc/sys/vm/swappiness
cat /proc/sys/vm/vfs_cache_pressure
Change Swap Parameters
sudo sysctl vm.swappiness=10
sudo sysctl vm.vfs_cache_pressure=50
Open sysctl.conf for Editing
sudo nano /etc/sysctl.conf
vm.swappiness=10
vm.vfs_cache_pressure=50
Check Swap File
sudo swapon --show

Leave a comment

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