Prerequisites
Before starting, ensure you have the following:- A fresh Ubuntu 24.04 server with root or sudo access.
- A registered domain name with an A record pointing to your server’s public IP address.
- An SSH client (e.g., Terminal, PuTTY) and an SFTP client (e.g., FileZilla).
- A secure password for the database user.
- Your application’s source code and database SQL file.
Table of Contents
- Connect to the Server
- Install and Configure Dependencies
- Upload Source Code
- Configure Application
- Enable HTTPS
- Set Up Firewall
- Troubleshooting
Step 1: Connect to the Server
Connect to your server via SSH to begin the setup process.Connect via SSH
Connect via SSH
- Obtain your server’s IP address from your hosting provider.
-
Open a terminal and connect:
ssh root@<your-server-ip> -
If using a key-based connection:
ssh -i yourkey.pem root@<your-server-ip>Verify SSH Service
Step 2: Install and Configure Dependencies
Install the necessary software packages for your Aleuto application, including Nginx, PHP 8.4, PostgreSQL, Node.js, Redis, Memcached, Supervisor, and Certbot.Update and Install Basic Packages
Update and Install Basic Packages
Update Package List
Upgrade Packages
Install Basic Packages
Verify Installation
Create Swap Space
Create Swap Space
Create Swap Space
Verify Swap
Install Nginx
Install Nginx
Install Nginx
Remove Default Site
Verify Nginx
Install PHP 8.4
Install PHP 8.4
Add PHP Repository
Update Package Lists
Install Generic PHP Packages
Install PHP 8.4
Configure PHP for Secure Connections
Restart PHP-FPM
Verify PHP
Install Composer
Install Composer
Download Composer
Move Composer
Verify Composer
Install Node.js and NPM
Install Node.js and NPM
Add Node.js Repository
Update Package Lists
Install Node.js and Tools
Verify Node.js and NPM
Install Redis
Install Redis
Install Redis
Enable and Start Redis
Verify Redis
Install PostgreSQL
Install PostgreSQL
Install PostgreSQL
Configure PostgreSQL Users
Configure Remote Access
Create Database
Restart PostgreSQL
Verify PostgreSQL
Install Memcached
Install Memcached
Install Memcached
Enable and Start Memcached
Verify Memcached
Install Supervisor
Install Supervisor
Install Supervisor
Enable and Start Supervisor
Verify Supervisor
Configure Supervisor for Horizon and Reverb
Configure Supervisor for Horizon and Reverb
Create Horizon Configuration
Horizon Configuration
Create Reverb Configuration
Reverb Configuration
Update Supervisor
Verify Supervisor Processes
Install Certbot
Install Certbot
Install Certbot
Verify Certbot
Clean Up
Clean Up
Upgrade Check
Clean Up
Step 3: Upload Source Code
Upload your Aleuto application’s source code and database to the server.Upload Source Code
Upload Source Code
- Download FileZilla Client.
- Download your application’s source code.
- Upload the source code to
/var/www/aleuto.
Set Permissions
Import Database
Import Database
Import SQL File
Verify Database Import
Step 4: Configure Application
Configure Nginx and Laravel to serve your application.Configure Nginx
Configure Nginx
Create Nginx Configuration
Nginx Configuration
Enable Site
Test Nginx Configuration
Restart Nginx
Configure Laravel
Configure Laravel
Navigate to Project Directory
Copy .env.example
Edit .env File
Example .env Configuration
Install Composer Dependencies
Install NPM Dependencies
Build Frontend Assets
Generate Application Key
Set Permissions
Add User to www-data Group
Create Storage Link
Set Up Laravel Scheduler
Add Cron Job
Verify Laravel
Step 5: Enable HTTPS
Secure your application with an SSL certificate using Certbot.Enable HTTPS
Enable HTTPS
Configure DNS
Obtain SSL Certificate
Test SSL Renewal
Restart Nginx
Verify SSL
Step 6: Set Up Firewall
Configure the firewall to allow necessary traffic.Configure Firewall
Configure Firewall
Allow SSH, HTTP, HTTPS, and Reverb
Enable Firewall
Verify Firewall Status
Step 7: Troubleshooting
Common issues and solutions:- Nginx Fails to Start:
- Check syntax:
sudo nginx -t - View logs:
cat /var/log/nginx/error.log - Database Connection Errors:
- Verify
.envcredentials match the PostgreSQL user and database. - Test connection:
psql -U aleuto_user -d aleuto_db -h 127.0.0.1 - Permission Issues:
- Ensure
www-dataowns files:sudo chown -R www-data:www-data /var/www/aleuto - Check permissions:
ls -l /var/www/aleuto - Application Not Loading:
- Verify Laravel logs:
cat /var/www/aleuto/storage/logs/laravel.log - Ensure PHP-FPM is running:
sudo systemctl status php8.4-fpm - Horizon or Reverb Not Running:
- Check Supervisor status:
sudo supervisorctl status - View logs:
cat /var/www/aleuto/storage/logs/horizon.logorcat /var/www/aleuto/storage/logs/reverb.log - Ensure packages are installed:
composer require laravel/horizon laravel/reverb
Summary
You’ve successfully set up an Ubuntu 24.04 server with Nginx, PHP 8.4, PostgreSQL 17, Node.js, Redis, Memcached, Supervisor, and a Aleuto application with Horizon and Reverb, secured with an SSL certificate. Your application should now be accessible athttps://your-domain.com.