Skip to main content

Overview

The site command is your primary tool for managing websites on your Webinoly server. It supports creating HTML, PHP, MySQL, and WordPress sites, along with advanced features like SSL, caching, cloning, and multisite conversion.

Basic Usage

sudo site <domain> <option> <argument>

Creating Sites

HTML Site

Create a static HTML site:
sudo site example.com -html
With subfolder:
sudo site example.com -html -subfolder=/docs

PHP Site

Create a PHP site:
sudo site example.com -php
With subfolder:
sudo site example.com -php -subfolder=/app

MySQL/PHP Site

Create a PHP site with MySQL database:
# Interactive mode (prompts for database details)
sudo site example.com -mysql

# Unattended mode
sudo site example.com -mysql=[localhost,dbname,dbuser,dbpass]
-mysql
string
Database configuration:
  • true - Interactive mode (prompts for details)
  • [host,name,user,pass] - Unattended mode with database credentials
  • default - Use default settings (deprecated, use true)

WordPress Site

Create a WordPress site:
# Interactive mode
sudo site example.com -wp

# Unattended mode (full configuration)
sudo site example.com -wp=[true,true,localhost,dbname,dbuser,dbpass,wp_]
-wp
string
WordPress installation configuration:Format: [setupdb,setupwp,dbhost,dbname,dbuser,dbpass,dbprefix,extdbuser,extdbpass]
  • setupdb - Create database (true/false)
  • setupwp - Install WordPress (true/false)
  • dbhost - Database host (localhost or IP:port)
  • dbname - Database name
  • dbuser - Database user
  • dbpass - Database password (random generates random password)
  • dbprefix - WordPress table prefix
  • extdbuser - External DB admin user (optional)
  • extdbpass - External DB admin password (optional)
-env
string
WordPress environment type:
  • production - Production environment (default)
  • staging - Staging environment
  • development - Development environment
  • local - Local development
WordPress with subfolder:
sudo site example.com -wp -subfolder=/blog
WordPress with custom environment:
sudo site example.com -wp -env=staging

Empty Site

Create an empty site structure for custom Nginx configuration:
# Empty site with basic structure
sudo site example.com -empty

# Completely blank site
sudo site example.com -empty=blank
Empty sites require you to add your own Nginx configuration in /var/www/example.com/*-nginx.conf

Parked Domain

Park a domain (point to another site):
sudo site parked.com -parked=example.com
-parked
string
Main domain to park to
-root-path
string
Custom root path for parked domain (optional)

Reverse Proxy

Create a reverse proxy:
# Proxy to local port
sudo site example.com -proxy=3000

# Proxy to remote server
sudo site example.com -proxy=http://backend.internal:8080

# Dedicated reverse proxy (different FastCGI cache)
sudo site example.com -proxy=3000 -dedicated-reverse-proxy
-proxy
string
Proxy target:
  • Port number (e.g., 3000) - Proxies to localhost:port
  • Full URL (e.g., http://backend:8080) - Proxies to remote server
-dedicated-reverse-proxy
boolean
Use separate FastCGI cache for reverse proxy

Forward Domain

Forward/redirect a domain:
# Redirect to another domain
sudo site old.com -forward=new.com

# Custom HTTP redirect code
sudo site old.com -forward=new.com -http-code=302
-forward
string
Target domain to forward to
-http-code
number
default:"301"
HTTP redirect code (301 or 302)

SSL/TLS Configuration

Enable SSL with Let’s Encrypt

# Request SSL certificate
sudo site example.com -ssl

# Test certificate (staging)
sudo site example.com -ssl -test-cert

# Wildcard certificate (requires manual DNS verification)
sudo site example.com -ssl -wildcard
-ssl
string
SSL configuration:
  • on - Enable SSL with Let’s Encrypt
  • off - Disable SSL
  • force-renewal - Force certificate renewal
  • renew - Renew all certificates
  • force-renewal-all - Force renew all certificates
-wildcard
boolean
Request wildcard certificate (*.example.com)
-test-cert
boolean
Use Let’s Encrypt staging environment for testing

Add Subdomain to Wildcard Certificate

sudo site sub.example.com -ssl -add-to-wildcard=example.com
-add-to-wildcard
string
Wildcard domain certificate to use

Custom SSL Certificate

sudo site example.com -ssl=on -ssl-crt=/path/to/cert.crt -ssl-key=/path/to/key.key
-ssl-crt
string
Path to SSL certificate file
-ssl-key
string
Path to SSL private key file

Force HTTPS Redirect

Configure www/non-www redirect:
# Force www (example.com → www.example.com)
sudo site example.com -force-redirect=www

# Force root/non-www (www.example.com → example.com)
sudo site example.com -force-redirect=root

# Disable forced redirect
sudo site example.com -force-redirect=off
-force-redirect
string
Redirect type:
  • www - Force www subdomain
  • root - Force non-www (root domain)
  • off - Disable forced redirect
SSL must be enabled before configuring force-redirect. Subdomains cannot use force-redirect.

FastCGI Cache

Enable Cache

# Enable FastCGI cache for WordPress
sudo site example.com -cache=on

# Enable with subfolder
sudo site example.com -cache=on -subfolder=/blog
-cache
string
Cache configuration:
  • on - Enable FastCGI cache
  • off - Disable FastCGI cache

Custom Cache Configuration

# Custom cache valid time
sudo site example.com -cache=on -cache-valid=7d

# Skip cache for specific paths
sudo site example.com -skip-cache=/checkout,/cart

# Skip cache based on cookies
sudo site example.com -skip-cookie-cache=wordpress_logged_in

# Query string cache behavior
sudo site example.com -query-string-cache=page,product_id
sudo site example.com -query-string-never-cache=nocache

# Use default query string caching
sudo site example.com -query-string-cache-default
-cache-valid
string
Cache valid time (e.g., 1h, 30m, 7d)
-wp-cache-plugins
boolean
Include WordPress cache plugin configurations
-skip-cache
string
Comma-separated paths to skip caching
Comma-separated cookies that bypass cache
-query-string-cache
string
Query strings to include in cache key
-query-string-never-cache
string
Query strings that always bypass cache
-query-string-cache-default
boolean
Use default query string configuration
-reset
boolean
Reset cache configuration to defaults

Site Operations

Enable/Disable Site

# Disable site (keep configuration)
sudo site example.com -off

# Re-enable site
sudo site example.com -on
-on
boolean
Enable a disabled site
-off
boolean
Disable a site (keeps all files and configuration)

Delete Site

# Delete site (prompts for confirmation)
sudo site example.com -delete

# Delete subfolder installation
sudo site example.com -delete -subfolder=/blog

# Force delete without confirmation
sudo site example.com -delete=force
-delete
string
Delete site:
  • true - Delete with confirmation
  • force - Delete without confirmation
-delete-all
string
Delete all sites:
  • true - Delete all (prompts for confirmation)
  • force - Delete all without confirmation
Deleting a site removes all files, databases, and configurations. Create a backup first!

List Sites

List all configured sites:
sudo site -list
Example output:
+ example.com - WordPress (FastCGI Cache: ON | SSL: ON)
+ test.com - PHP (SSL: OFF)
+ static.com - HTML

Site Information

Display detailed site information:
# Main site info
sudo site example.com -info

# Subfolder info
sudo site example.com -info -subfolder=/blog
Shows:
  • Site type (HTML, PHP, WordPress, etc.)
  • SSL status and certificate details
  • Cache status
  • Database information (for WordPress/MySQL sites)
  • Multisite configuration
  • File paths

WordPress Management

Convert to Multisite

Convert WordPress single site to multisite:
# Subdomain multisite
sudo site example.com -multisite-convert=subdomain

# Subdirectory multisite
sudo site example.com -multisite-convert=subdirectory
-multisite-convert
string
Multisite type:
  • subdomain - Subdomain-based multisite
  • subdirectory - Subdirectory-based multisite
Multisite conversion is irreversible. Backup your site first!

Clone Site

Clone an existing site to a new domain:
# Clone entire site
sudo site newsite.com -clone-from=example.com

# Clone to subfolder
sudo site example.com -clone-from=example.com -subfolder=/staging

# Overwrite existing site
sudo site newsite.com -clone-from=example.com -overwrite=on
-clone-from
string
Source domain to clone from
-overwrite
string
Overwrite destination if it exists:
  • on - Overwrite existing site
Supports cloning from/to subfolders:
# Clone subfolder to main site
sudo site staging.com -clone-from=example.com -subfolder=/blog
  • Only HTML, PHP, and WordPress sites can be cloned
  • Source and destination must be the same site type
  • WordPress multisite cannot be cloned

Replace Content

Search and replace in WordPress database:
# Interactive mode
sudo site example.com -replace-content

# Direct replacement
sudo site example.com -replace-content -from=oldtext -to=newtext
-from
string
Text to search for
-to
string
Replacement text
Commonly used when changing domains or fixing URLs in the database

WordPress Environment Type

Set WordPress environment type:
sudo site example.com -env=production
sudo site example.com -env=staging
sudo site example.com -env=development
-env
string
WordPress environment:
  • production - Production (WP_DEBUG off)
  • staging - Staging (WP_DEBUG on, display off)
  • development - Development (WP_DEBUG on, display on)
  • local - Local development

Redirections

Manage URL redirections:
# Add redirection
sudo site example.com -redirection=/old-path -to=/new-path

# Redirection with custom HTTP code
sudo site example.com -redirection=/old -to=/new -http-code=302

# Regex redirection
sudo site example.com -redirection=/blog/(.*) -to=/news/$1 -regex

# Exact match only
sudo site example.com -redirection=/exact-path -to=/new -exact

# List all redirections
sudo site example.com -redirection -list

# Delete redirection
sudo site example.com -redirection=/old-path -delete

# Delete all redirections
sudo site example.com -redirection -delete-all
-redirection
string
Source path to redirect from
-to
string
Destination path or URL
-http-code
number
default:"301"
HTTP redirect code (301, 302, etc.)
-regex
boolean
Use regex for redirection matching
-exact
boolean
Exact path match only (no path prefix matching)

Advanced Options

External Database

Use external MySQL/MariaDB server:
# Interactive setup
sudo site example.com -wp -external-db

# Or provide in WP config
sudo site example.com -wp=[true,true,192.168.1.100:3306,dbname,dbuser,dbpass,wp_,extadmin,extpass]
-external-db
boolean
Use external database (prompts for connection details)

Custom Root Path

Specify custom document root:
sudo site example.com -php -root=/custom/path
-root
string
Custom document root path

Subdomain Handling

Control subdomain behavior:
# Create site for specific subdomain only
sudo site sub.example.com -wp -subdomain=true
-subdomain
boolean
Treat as subdomain (affects www handling)

Ignore SSL Checks

Skip SSL verification during certain operations:
sudo site example.com -clone-from=source.com -ignore-ssl
-ignore-ssl
boolean
Skip SSL certificate verification

Examples

Simple WordPress Site

# Create WordPress site with SSL
sudo site example.com -wp
sudo site example.com -ssl
sudo site example.com -cache=on

WordPress Multisite with SSL

# Create main site
sudo site example.com -wp

# Get wildcard certificate
sudo site example.com -ssl -wildcard

# Convert to subdomain multisite
sudo site example.com -multisite-convert=subdomain

# Enable cache
sudo site example.com -cache=on

Staging Site Setup

# Clone production to staging
sudo site staging.example.com -clone-from=example.com

# Set environment
sudo site staging.example.com -env=staging

# Update URLs in database
sudo site staging.example.com -replace-content -from=example.com -to=staging.example.com

# Get SSL
sudo site staging.example.com -ssl

High-Performance WordPress

# Create site
sudo site example.com -wp

# Enable SSL with force redirect
sudo site example.com -ssl
sudo site example.com -force-redirect=root

# Configure cache
sudo site example.com -cache=on -cache-valid=7d
sudo site example.com -skip-cache=/checkout,/cart,/my-account
sudo site example.com -wp-cache-plugins

Reverse Proxy with SSL

# Create reverse proxy
sudo site api.example.com -proxy=http://backend:8080

# Enable SSL
sudo site api.example.com -ssl

# Enable dedicated cache
sudo site api.example.com -proxy=http://backend:8080 -dedicated-reverse-proxy

Subfolder Support

Many operations support the -subfolder argument:
# Create WordPress in subfolder
sudo site example.com -wp -subfolder=/blog

# Enable cache for subfolder
sudo site example.com -cache=on -subfolder=/blog

# Clone subfolder
sudo site newsite.com -clone-from=example.com -subfolder=/blog

# Delete subfolder
sudo site example.com -delete -subfolder=/blog

# View subfolder info
sudo site example.com -info -subfolder=/blog
Supported commands with subfolders:
  • -wp, -php, -html, -mysql
  • -cache
  • -delete
  • -clone-from
  • -replace-content
  • -env
  • -info
  • -multisite-convert

Notes

  • All commands require sudo (root privileges)
  • Site configurations are stored in /etc/nginx/sites-available/
  • Website files are located in /var/www/[domain]/htdocs/
  • Nginx is automatically reloaded after configuration changes
  • SSL certificates auto-renew via cron job
  • Use -help for complete option list

See Also

Build docs developers (and LLMs) love