- Spin up a new App server, choose PHP 8
- SSH into it and run
sudo -i
to become root - Run
pecl install swoole
and enable what you need. (I disabled curl as it did not work for me) - Add a new Site to your server and use git to pull in your Laravel project that has Octane installed.
- Point your DNS to your new site
- Enable SSL using Lets Encrypt
- Change your new Sites Nginx settings to (assuing your site is named octane.example.com):
# FORGE CONFIG (DO NOT REMOVE!)
include forge-conf/octane.example.com/before/*;
upstream swoole-http {
server 127.0.0.1:8000;
}
map $http_upgrade $connection_upgrade {
default upgrade;
'' close;
}
server {
listen 443 ssl http2;
listen [::]:443 ssl http2;
server_name octane.example.com;
server_tokens off;
root /home/forge/octane.example.com/public;
index index.php;
charset utf-8;
# FORGE CONFIG (DO NOT REMOVE!)
include forge-conf/octane.example.com/server/*;
location = /index.php {
try_files /not_exists @swoole;
}
location / {
try_files $uri $uri/ @swoole;
}
location @swoole {
set $suffix "";
if ($uri = /index.php) {
set $suffix ?$query_string;
}
proxy_http_version 1.1;
proxy_set_header Host $http_host;
proxy_set_header Scheme $scheme;
proxy_set_header SERVER_PORT $server_port;
proxy_set_header REMOTE_ADDR $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
proxy_pass http://swoole-http$suffix;
}
}
# FORGE CONFIG (DO NOT REMOVE!)
include forge-conf/octane.example.com/after/*;
- Change the deploy Script to:
cd /home/forge/octane.example.com
git pull origin master
$FORGE_COMPOSER install --no-interaction --prefer-dist --optimize-autoloader --no-dev
$FORGE_PHP artisan migrate --force
$FORGE_PHP artisan config:cache
$FORGE_PHP artisan route:cache
$FORGE_PHP artisan octane:reload
- Go to Daemons settings of the server
- Command: php8.0 artisan octane:start --server=swoole --port=8000
- User: forge
- Directory: /home/forge/octane.example.com
- Processes: 1
- Start: 1
Now - go test out Octane and its speed 🚀