-
Notifications
You must be signed in to change notification settings - Fork 41
Digital Ocean Setup
Ryan Haudenschilt edited this page Mar 25, 2024
·
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>';
exit
sudo mysql_secure_installation
sudo apt install php libapache2-mod-php php-mysql
-
Configure apache vhosts
sudo mkdir /var/www/fcms
sudo chown -R $USER:$USER /var/www/fcms
sudo vi /etc/apache2/sites-available/fcms.conf
<VirtualHost *:80> ServerName <YOUR_DOMAIN> ServerAlias <YOUR_DOMAIN> ServerAdmin webmaster@localhost DocumentRoot /var/www/fcms/public <Directory /var/www/fcms/public> Options +FollowSymlinks AllowOverride All Require all granted </Directory> ErrorLog ${APACHE_LOG_DIR}/error.log CustomLog ${APACHE_LOG_DIR}/access.log combined </VirtualHost>
sudo a2ensite fcms
sudo a2dissite 000-default
sudo a2enmod rewrite
sudo systemctl reload apache2
-
Configure php.ini
sudo vi /etc/php/8.1/apache2/php.ini
upload_max_filesize = 64M
post_max_size = 64M
-
Add rest of things laravel needs
sudo apt update
sudo apt install php-mbstring php-xml php-bcmath php-curl php-imagick
-
sudo apt install php-cli unzip
? cd ~
curl -sS https://getcomposer.org/installer -o /tmp/composer-setup.php
sudo php /tmp/composer-setup.php --install-dir=/usr/local/bin --filename=composer
cd ~
-
curl -sL https://deb.nodesource.com/setup_18.x -o nodesource_setup.sh
? sudo bash nodesource_setup.sh
sudo apt install nodejs
-
Setup the laravel project
cd /var/www/fcms
sudo git clone https://github.com/ryanhowdy/fcms.git .
composer install
npm install
cp .env.example .env
php artisan key:generate
sudo chown -R $USER:www-data storage
sudo chown -R $USER:www-data bootstrap/cache
chmod -R 775 storage
chmod -R 775 bootstrap/cache
-
(Optional) Install SSL Cert