Skip to main content

Installation

Installing on a digital ocean droplet

Instructions for setting up on a virtual server like digital ocean

Instructions for setting up on a virtual server like digital ocean

1. Connect to Your Droplet via SSH

Open your terminal and SSH into your DigitalOcean droplet.

ssh root@your_droplet_ip

2. Update Package Lists

Update the package lists to ensure you get the latest versions and dependencies.

sudo apt-get update

3. Install Required Packages

Install PHP, Composer, and other required dependencies.

sudo apt-get install -y php8.0 php8.0-fpm php8.0-cli php8.0-json php8.0-common php8.0-mysql php8.0-zip php8.0-gd php8.0-mbstring php8.0-curl php8.0-xml php8.0-bcmath

4. Install Composer

curl -sS https://getcomposer.org/installer | php sudo mv composer.phar /usr/local/bin/composer

5. Install Node.js and npm

sudo apt-get install -y nodejs npm

6. Clone Your aptree Repository

Navigate to the directory where you'd like to install your project, then clone your repository.

cd /var/www git clone https://github.com/yourusername/aptree.git

7. Navigate to Your Project Directory

cd aptree

8. Install PHP Dependencies

composer install

9. Install JavaScript Dependencies

npm install npm run build

10. Set Up Environment File

Copy .env.example to create .env.

cp .env.example .env

11. Generate Application Key

php artisan key:generate

12. Configure Environment Variables

Open .env and update the database and other configurations.

nano .env

13. Migrate the Database

php artisan migrate

14. Set Permissions

sudo chown -R www-data:www-data /var/www/aptree sudo chmod -R 755 /var/www/aptree/storage

15. Configure Web Server (Nginx)

Create a new Nginx configuration file.

sudo nano /etc/nginx/sites-available/aptree

Add the following (adjust domain, paths, and other variables as needed):

server {
    listen 80;
    server_name your_domain.com;
    root /var/www/aptree/public;

    add_header X-Frame-Options "SAMEORIGIN";
    add_header X-XSS-Protection "1; mode=block";
    add_header X-Content-Type-Options "nosniff";

    index index.html index.htm index.php;

    charset utf-8;

    location / {
        try_files $uri $uri/ /index.php?$query_string;
    }

    location = /favicon.ico { access_log off; log_not_found off; }
    location = /robots.txt  { access_log off; log_not_found off; }

    access_log off;
    error_log  /var/log/nginx/aptree-error.log error;

    sendfile off;

    client_max_body_size 100m;

    location ~ \.php$ {
        fastcgi_split_path_info ^(.+\.php)(/.+)$;
        fastcgi_pass unix:/var/run/php/php8.0-fpm.sock;
        fastcgi_index index.php;
        include fastcgi_params;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;

        fastcgi_intercept_errors off;
        fastcgi_buffer_size 16k;
        fastcgi_buffers 4 16k;
        fastcgi_connect_timeout 300;
        fastcgi_send_timeout 300;
        fastcgi_read_timeout 300;
    }

    location ~ /\.(?!well-known).* {
        deny all;
    }
}

Enable the Nginx configuration by creating a symlink:

sudo ln -s /etc/nginx/sites-available/aptree /etc/nginx/sites-enabled

16. Restart Nginx and PHP 8.0

sudo service php8.0-fpm restart
sudo service nginx restart

Congratulations, you've successfully deployed aptree on a DigitalOcean droplet using the TALL stack! You should now be able to access your application by visiting your droplet's IP address or domain name.