Skip to content

Digital Ocean Setup

Ryan Haudenschilt edited this page Oct 17, 2022 · 27 revisions
  1. Create a new droplet

  2. SSH into new droplet as root ?

  3. Create a new user with superuser

    1. adduser XXX
    2. usermod -aG sudo XXX
  4. Configure firewall

    1. ufw allow OpenSSH
    2. ufw enable
  5. SSH into droplet as XXX user

  6. OPTIONAL - If droplet has less than 1GB ram, add swap space.

    1. sudo fallocate -l 1G /swapfile
    2. sudo chmod 600 /swapfile
    3. sudo mkswap /swapfile
    4. sudo cp /etc/fstab /etc/fstab.bak
    5. echo '/swapfile none swap sw 0 0' | sudo tee -a /etc/fstab
  7. Install the LAMP or LEMP stack ?

    1. sudo apt update
    2. sudo apt install apache2
    3. sudo ufw allow in "Apache Full"
    4. sudo apt install mysql-server
    5. sudo mysql
    6. ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password by '<ROOT_DB_PASSWORD>';
    7. sudo mysql_secure_installation
    8. sudo apt install php8.1-fpm php-mysql
    9. sudo apt install php-mbstring php-xml php-bcmath php-curl
    10. Install composer ?
    11. Install nodejs ?
  8. Setup the laravel project

    1. cd /var/www/html
    2. sudo git clone GIT_REPO_URL
    3. composer install
    4. cp .env.example .env
    5. sudo chown -R $USER:www-data /var/www/html/GIT_REPO_URL ?
    6. sudo chmod -R 775 storage/
    7. sudo chown -R $USER:www-data bootstrap/cache
    8. sudo chmod -R 775 bootstrap/cache
    9. php artisan key:generate
  9. Configure Nginx to work with laravel

    1. Copy the Nginx config from laravel's site to /etc/nginx/sites-available/default
    2. Change server_name to your domain or localhost
    3. change root to /var/www/html/GIT_REPO_URL/public
    4. Make sure the php version matches what was installed above
    5. sudo systemctl reload nginx

If npm run dev is killed unexpectedly, it's probably out of swap space.

Home

Contribute

User Documentation

Clone this wiki locally