-
Notifications
You must be signed in to change notification settings - Fork 41
Digital Ocean Setup
Ryan Haudenschilt edited this page Oct 17, 2022
·
27 revisions
-
Create a new droplet
-
SSH into new droplet as root ?
-
Create a new user with superuser
adduser XXX
usermod -aG sudo XXX
-
Configure firewall
ufw allow OpenSSH
ufw enable
-
SSH into droplet as XXX user
-
OPTIONAL - If droplet has less than 1GB ram, add swap space.
sudo fallocate -l 1G /swapfile
sudo chmod 600 /swapfile
sudo mkswap /swapfile
sudo cp /etc/fstab /etc/fstab.bak
echo '/swapfile none swap sw 0 0' | sudo tee -a /etc/fstab
-
Install the LAMP or LEMP stack ?
sudo apt update
sudo apt install apache2
sudo ufw allow in "Apache Full"
sudo apt install mysql-server
sudo mysql
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password by '<ROOT_DB_PASSWORD>';
sudo mysql_secure_installation
sudo apt install php8.1-fpm php-mysql
sudo apt install php-mbstring php-xml php-bcmath php-curl
- Install composer ?
- Install nodejs ?
-
Setup the laravel project
cd /var/www/html
sudo git clone GIT_REPO_URL
composer install
cp .env.example .env
-
sudo chown -R $USER:www-data /var/www/html/GIT_REPO_URL
? sudo chmod -R 775 storage/
sudo chown -R $USER:www-data bootstrap/cache
sudo chmod -R 775 bootstrap/cache
php artisan key:generate
-
Configure Nginx to work with laravel
- Copy the Nginx config from laravel's site to /etc/nginx/sites-available/default
- Change server_name to your domain or localhost
- change root to
/var/www/html/GIT_REPO_URL/public
- Make sure the php version matches what was installed above
sudo systemctl reload nginx
If npm run dev
is killed unexpectedly, it's probably out of swap space.