xxxxxxxxxx
ufw allow http
ufw allow https
# Download FrankenPHP binary
cd /home/forge
wget https://github.com/dunglas/frankenphp/releases/download/v1.0.2/frankenphp-linux-x86_64
# Create a directory for FrankenPHP configuration
cp frankenphp-linux-x86_64 frankenphp
chown forge:forge frankenphp
chmod +x frankenphp
mkdir example.com
mkdir example.com/public/
touch example.com/public/index.php
cat << EOF > /home/forge/example.com/public/index.php
<?php
echo "domain.com";
EOF
# Create the systemd service file
touch /etc/systemd/system/frankServer.service
# Paste the service file contents
cat << EOF > /etc/systemd/system/frankServer.service
[Unit]
Description=frankServer Caddy service
After=network.target
[Service]
User=forge
WorkingDirectory=/home/forge/
ExecStart=/home/forge/frankenphp run --config /home/forge/Caddyfile
Restart=always
[Install]
WantedBy=multi-user.target
EOF
# Create the Caddyfile for FrankenPHP
touch /home/forge/Caddyfile
# Paste the Caddyfile content
cat << EOF > /home/forge/Caddyfile
{
frankenphp
order mercure after encode
order php_server before file_server
}
# The domain name of your server
example.com {
# Set the webroot to the public/ dir
root * example.com/public/
# Enable compression (optional)
encode zstd gzip
mercure {
# Publisher JWT key
publisher_jwt !ChangeThisMercureHubJWTSecretKey!
# Subscriber JWT key
subscriber_jwt !ChangeThisMercureHubJWTSecretKey!
}
# Execute PHP files in the current directory and serve assets
php_server {
# Required for the public/storage/ dir
resolve_root_symlink
}
}
EOF
chown forge:forge Caddyfile
# Grant the `net_bind_service` capability to the FrankenPHP binary
setcap 'cap_net_bind_service=+ep' /home/forge/frankenphp
# Enable the systemd service
systemctl enable frankServer
# Start the systemd service
systemctl start frankServer
Design © 2025. ForgeRecipes loves you.
Site maintained by Vince Mitchell.
Inspired by original by David Hemphill, Tanner Hearne, & Matt Stauffer.