Requirements
- A REGTR cloud server (Ubuntu 24.04)
- A domain and A record
- A sudo user
Steps
-
1Install packages
Ubuntu 24.04 ships PHP 8.3; install the extensions Laravel needs.
sudo apt update sudo apt install -y nginx mysql-server unzip git php8.3-fpm php8.3-cli php8.3-mysql php8.3-mbstring php8.3-xml php8.3-curl php8.3-zip php8.3-bcmath php8.3-intl -
2Install Composer
Install the PHP dependency manager system-wide.
curl -sS https://getcomposer.org/installer -o composer-setup.php sudo php composer-setup.php --install-dir=/usr/local/bin --filename=composer rm composer-setup.php -
3Create the database
Create a database and a user with rights only to it. Choose your own password.
sudo mysql -e "CREATE DATABASE app CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;" sudo mysql -e "CREATE USER 'app'@'localhost' IDENTIFIED BY 'BURAYA-GUCLU-BIR-PAROLA';" sudo mysql -e "GRANT ALL PRIVILEGES ON app.* TO 'app'@'localhost';" -
4Install the app
Clone the repository, install dependencies, edit .env (DB_DATABASE, DB_USERNAME, DB_PASSWORD) and run migrations.
sudo mkdir -p /var/www/app && sudo chown $USER:$USER /var/www/app git clone https://github.com/KULLANICI/PROJE.git /var/www/app cd /var/www/app composer install --no-dev --optimize-autoloader cp .env.example .env && php artisan key:generate nano .env php artisan migrate --force sudo chown -R www-data:www-data storage bootstrap/cache -
5Nginx site
The document root must be the public folder; hidden files are blocked.
sudo tee /etc/nginx/sites-available/app >/dev/null <<'EOF' server { listen 80; server_name example.com; root /var/www/app/public; index index.php; location / { try_files $uri $uri/ /index.php?$query_string; } location ~ \.php$ { include snippets/fastcgi-php.conf; fastcgi_pass unix:/run/php/php8.3-fpm.sock; } location ~ /\.(?!well-known) { deny all; } } EOF sudo ln -s /etc/nginx/sites-available/app /etc/nginx/sites-enabled/ sudo nginx -t && sudo systemctl reload nginx -
6Queue worker and scheduler
The queue worker runs continuously under systemd, the scheduler fires every minute. For SSL, follow the certbot step from the Node.js guide.
sudo tee /etc/systemd/system/laravel-queue.service >/dev/null <<'EOF' [Unit] Description=Laravel queue worker After=network.target [Service] User=www-data WorkingDirectory=/var/www/app ExecStart=/usr/bin/php artisan queue:work --sleep=3 --tries=3 --max-time=3600 Restart=always [Install] WantedBy=multi-user.target EOF sudo systemctl enable --now laravel-queue (sudo crontab -u www-data -l 2>/dev/null; echo "* * * * * cd /var/www/app && php artisan schedule:run >> /dev/null 2>&1") | sudo crontab -u www-data -
Tips
- Make sure APP_DEBUG=false and APP_ENV=production in .env so error details are never shown to visitors.
- php artisan config:cache route:cache view:cache speeds up production.
- Don't expose MySQL; allow local (localhost) access only.
FAQ
Which plan?
For a medium-traffic Laravel app, 2 vCPU / 4 GB AMD EPYC (Performance 2) is a good start; move to dedicated CPU when the database grows.
Can I use PHP 8.4?
Yes, via the ondrej/php PPA; this guide uses PHP 8.3 from Ubuntu's own repository.
Updated: 2026-10-23