Laravel Octane Setup on VPS (Step-by-Step Guide for 2025)
Laravel Octane Setup on VPS (Step-by-Step Guide for 2025)
If you’re looking to boost your Laravel app speed by 10x, Laravel Octane is the secret weapon you need.
Octane runs Laravel using high-performance application servers like Swoole or RoadRunner, giving you blazing-fast responses.
In this guide, we’ll go step-by-step through installing and configuring Laravel Octane on a VPS.
---
🚀 What Is Laravel Octane?
Laravel Octane is a performance package that keeps your application in memory between requests — unlike traditional PHP-FPM setups that restart the framework on every request.
⚡ Key Benefits
---
🧰 Prerequisites
Before starting, make sure your VPS has:
---
⚙️ Step 1 — Update Your VPS
sudo apt update && sudo apt upgrade -y---
🧩 Step 2 — Install PHP & Extensions
sudo apt install php php-cli php-common php-mbstring php-xml php-curl php-bcmath php-zip php-mysql unzip git -y---
🧱 Step 3 — Install Composer
curl -sS https://getcomposer.org/installer | php
sudo mv composer.phar /usr/local/bin/composer
composer --version---
📦 Step 4 — Clone or Create Laravel Project
cd /var/www
git clone https://github.com/yourusername/todoproject.git
cd todoproject
composer install
cp .env.example .env
php artisan key:generate---
🔥 Step 5 — Install Laravel Octane
composer require laravel/octane
php artisan octane:installWhen prompted, choose your preferred server — Swoole (recommended) or RoadRunner.
---
🧠 Step 6 — Install Swoole or RoadRunner
Option 1: Install Swoole
sudo apt install php-swooleOption 2: Install RoadRunner
./vendor/bin/rr get-binary---
🏗️ Step 7 — Start Laravel Octane Server
php artisan octane:start --server=swoole --host=0.0.0.0 --port=8000You can now visit your server’s IP on port 8000, e.g.:
👉 http://your-server-ip:8000
---
⚙️ Step 8 — Configure Nginx for Laravel Octane
Open your Nginx config:
sudo nano /etc/nginx/sites-available/laravelPaste this configuration:
server {
listen 80;
server_name projectdomain.com;
root /var/www/todoproject/public;
index index.php;
location / {
proxy_pass http://127.0.0.1:8000;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}Save and enable:
sudo ln -s /etc/nginx/sites-available/laravel /etc/nginx/sites-enabled/
sudo systemctl restart nginx---
🧩 Step 9 — Set Up Supervisor (Auto-Restart)
Install Supervisor:
sudo apt install supervisor -yAdd Laravel Octane to Supervisor:
sudo nano /etc/supervisor/conf.d/octane.confPaste:
[program:octane]
command=php artisan octane:start --server=swoole --host=127.0.0.1 --port=8000
directory=/var/www/todoproject
autostart=true
autorestart=true
user=www-data
redirect_stderr=true
stdout_logfile=/var/log/octane.logSave and start:
sudo supervisorctl reread
sudo supervisorctl update
sudo supervisorctl start octane---
🎯 Step 10 — Test Performance
Use any tool like ApacheBench or k6 to test:
ab -n 1000 -c 50 http://127.0.0.1:8000/You’ll notice drastically improved response times 🚀.
---
Final Notes
Laravel Octane is perfect for:
Keep your Octane server monitored and restart occasionally during deployments.
---
Keywords to Target
laravel octane setup
laravel octane swoole
laravel octane vps installation
laravel performance optimization 2025
laravel on ubuntu 22.04---
With this setup, your Laravel app can handle thousands of requests per second with minimal load — a true production-grade configuration for 2025.
Share this article
Enjoyed this article?
Support our work and help us create more free content for developers.
Stay Updated
Get the latest articles and updates delivered to your inbox.