WordPress Multisite Configuration

WordPress Multisite enables managing multiple sites from a single WordPress installation, sharing themes, plugins, and user bases while maintaining independent content and settings per site. This powerful feature supports networks ranging from simple multi-language sites to complex multi-brand operations. Proper configuration requires understanding network setup options, domain mapping, network admin features, and optimization for scale. This comprehensive guide covers Multisite architecture, subdomain versus subdirectory setups, Nginx configuration, network administration, theme and plugin management, and best practices for multi-site networks.

Table of Contents

Multisite Architecture and Planning

WordPress Multisite architecture shares a single WordPress installation across multiple sites with separate databases or separate tables depending on configuration.

Understanding Multisite structure:

  • Single WordPress core installation
  • Multiple sites with individual databases
  • Shared user base with per-site permissions
  • Network-wide plugins and themes
  • Site-specific plugins and themes

Decide between network architectures:

ArchitectureProsConsBest For
SubdomainSEO independent domainsWildcard DNS requiredMulti-language, multi-brand
SubdirectorySingle domain, easier DNSContent duplication concernsRelated content networks
Domain MappingTrue domain per sitePremium plugin requiredProfessional networks

Assess resource requirements:

  • Single installation reduces server load
  • Database replication increases complexity
  • Shared plugins enable bulk updates
  • Per-site customization requires careful planning

Enabling WordPress Multisite

Enable Multisite functionality in existing WordPress installation.

Backup WordPress before making changes:

# Backup WordPress database
mysqldump -u wordpress_user -p wordpress_db > wp-multisite-backup.sql

# Backup WordPress files
tar czf wordpress-backup.tar.gz /var/www/wordpress/

Add Multisite constants to wp-config.php:

sudo nano /var/www/wordpress/wp-config.php

Add before the "That's all, stop editing" line:

/* Enable WordPress Multisite */
define('WP_ALLOW_MULTISITE', true);

Save and reload WordPress admin. Navigate to Tools > Network Setup to begin Multisite installation.

WordPress displays Multisite installation instructions. Choose your network setup:

# Option 1: Subdomain example.com, site1.example.com, site2.example.com
# Option 2: Subdirectory example.com/site1, example.com/site2

WordPress generates required configuration. Add to wp-config.php:

/* Multisite Configuration */
define('MULTISITE', true);
define('SUBDOMAIN_INSTALL', true); // or false for subdirectory
define('DOMAIN_CURRENT_SITE', 'example.com');
define('PATH_CURRENT_SITE', '/');
define('SITE_ID_CURRENT_SITE', 1);
define('BLOG_ID_CURRENT_SITE', 1);

Subdomain Network Setup

Configure DNS and WordPress for subdomain-based Multisite.

Configure wildcard DNS record:

# Add to DNS provider (example: Cloudflare, Route 53, etc.)
*.example.com  A  203.0.113.1

# Verify DNS propagation
nslookup *.example.com
dig *.example.com

# Test wildcard
nslookup test.example.com

Update wp-config.php for subdomain setup:

sudo nano /var/www/wordpress/wp-config.php

Ensure these constants:

define('MULTISITE', true);
define('SUBDOMAIN_INSTALL', true);
define('DOMAIN_CURRENT_SITE', 'example.com');
define('PATH_CURRENT_SITE', '/');
define('SITE_ID_CURRENT_SITE', 1);
define('BLOG_ID_CURRENT_SITE', 1);

// Cookie settings for subdomains
define('COOKIE_DOMAIN', '.example.com');

Update .htaccess (for Apache):

sudo nano /var/www/wordpress/.htaccess

WordPress provides .htaccess rules. For Nginx, we'll configure server blocks instead.

Create new site on the network:

# Via WordPress Admin: Network Admin > Sites > Add New
# Or via WP-CLI
wp site create --slug=newsite --title="New Site"

Verify subdomain site:

# Check DNS resolution
nslookup newsite.example.com

# Test site access
curl -I http://newsite.example.com/

Subdirectory Network Setup

Configure WordPress and Nginx for subdirectory-based Multisite.

Update wp-config.php for subdirectory setup:

sudo nano /var/www/wordpress/wp-config.php

Set these constants:

define('MULTISITE', true);
define('SUBDOMAIN_INSTALL', false);
define('DOMAIN_CURRENT_SITE', 'example.com');
define('PATH_CURRENT_SITE', '/');
define('SITE_ID_CURRENT_SITE', 1);
define('BLOG_ID_CURRENT_SITE', 1);

Update Nginx .htaccess equivalent for subdirectory:

WordPress requires proper rewrite rules. Nginx configuration in following section handles this.

Create new site:

# Via WordPress Admin: Network Admin > Sites > Add New
# Subdirectory sites created as: example.com/site1, example.com/site2
wp site create --slug=site1 --title="Site One"
wp site create --slug=site2 --title="Site Two"

Verify subdirectory sites:

curl -I http://example.com/site1/
curl -I http://example.com/site2/

Nginx Configuration for Multisite

Configure Nginx for both subdomain and subdirectory Multisite setups.

Create Nginx configuration for subdomain Multisite:

sudo nano /etc/nginx/sites-available/wordpress-multisite-subdomain.conf

Apply configuration:

# Upstream PHP-FPM
upstream php_backend {
    server unix:/run/php/php8.2-fpm.sock;
}

# Redirect non-www to www
server {
    listen 80;
    server_name example.com *.example.com;
    return 301 https://$server_name$request_uri;
}

# HTTPS server
server {
    listen 443 ssl http2;
    server_name example.com *.example.com;
    root /var/www/wordpress;
    index index.php index.html;

    # SSL configuration
    ssl_certificate /etc/letsencrypt/live/example.com/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/live/example.com/privkey.pem;

    # Security headers
    add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always;
    add_header X-Frame-Options "SAMEORIGIN" always;
    add_header X-Content-Type-Options "nosniff" always;

    # Logging
    access_log /var/log/nginx/multisite_access.log;
    error_log /var/log/nginx/multisite_error.log;

    # Cache static files
    location ~* \.(jpg|jpeg|png|gif|ico|css|js|svg|woff|woff2)$ {
        expires 30d;
        add_header Cache-Control "public, immutable";
    }

    # Block access to sensitive files
    location ~ /wp-config.php$ {
        deny all;
    }

    location ~ /\. {
        deny all;
    }

    # WordPress multisite rewrites
    location / {
        try_files $uri $uri/ /index.php?$args;
    }

    # PHP handler
    location ~ \.php$ {
        fastcgi_pass php_backend;
        fastcgi_index index.php;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        include fastcgi_params;
        fastcgi_param HTTP_HOST $http_host;
        fastcgi_param SERVER_NAME $server_name;
    }

    # Multisite subdomain support
    if (!-e $request_filename) {
        rewrite ^(.+)$ /index.php?$1 last;
    }
}

Enable configuration:

sudo ln -s /etc/nginx/sites-available/wordpress-multisite-subdomain.conf /etc/nginx/sites-enabled/
sudo nginx -t
sudo systemctl reload nginx

Create Nginx configuration for subdirectory Multisite:

sudo nano /etc/nginx/sites-available/wordpress-multisite-subdirectory.conf

Apply configuration:

upstream php_backend {
    server unix:/run/php/php8.2-fpm.sock;
}

server {
    listen 443 ssl http2;
    server_name example.com www.example.com;
    root /var/www/wordpress;
    index index.php;

    ssl_certificate /etc/letsencrypt/live/example.com/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/live/example.com/privkey.pem;

    access_log /var/log/nginx/multisite_access.log;
    error_log /var/log/nginx/multisite_error.log;

    # Cache static files
    location ~* \.(jpg|jpeg|png|gif|ico|css|js)$ {
        expires 30d;
    }

    # Block sensitive files
    location ~ /wp-config.php$ {
        deny all;
    }

    location ~ /\. {
        deny all;
    }

    # Multisite subdirectory rewrites
    location / {
        # Support subdirectory Multisite
        if (!-e $request_filename) {
            rewrite ^/([_0-9a-zA-Z-]+/)?(.*)$ /index.php?$args last;
        }
    }

    # PHP handler
    location ~ \.php$ {
        fastcgi_pass php_backend;
        fastcgi_index index.php;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        include fastcgi_params;
    }
}

server {
    listen 80;
    server_name example.com www.example.com *.example.com;
    return 301 https://$server_name$request_uri;
}

Network Administration

Manage WordPress Multisite network-wide settings and policies.

Access Network Admin:

# Network Admin URL: example.com/wp-admin/network/
# Only accessible with Super Admin role

Create new site via WP-CLI:

# Create with default parameters
wp site create --slug=newsite --title="New Site"

# Create with custom options
wp site create --slug=blog --title="Blog" [email protected] --porcelain

List all network sites:

wp site list
wp site list --format=table

Activate network-wide plugin:

# Activate plugin across all sites
wp plugin activate woocommerce --network

# List active network plugins
wp plugin list --network

Configure network settings:

# Set network settings via WP-CLI
wp network option update blogname "My Network"
wp network option update blogdescription "Description"
wp network option update site_name "Network Name"

# List network options
wp network option list

Configure file upload restrictions:

# Via Network Admin > Settings
# Set maximum upload size (in WordPress settings)
wp network option update fileupload_maxk 262144  # 256MB in KB

# Configure allowed file types
wp network option update upload_filetypes 'jpg jpeg png gif pdf txt docx xlsx'

User and Permission Management

Manage users across Multisite network with appropriate role hierarchy.

Understand Multisite user roles:

Super Admin (Network-wide admin)
  ├── Manage all sites
  ├── Manage network settings
  ├── Manage users
  └── Manage plugins

Site Admin (Per-site admin)
  ├── Manage site content
  ├── Manage site plugins/themes
  └── Manage site users

Create new Super Admin:

# Via Network Admin > Users > Add New
# Or via WP-CLI
wp user create superadmin [email protected] --role=administrator --network-id=1
wp super-admin add superadmin

Add user to specific site:

# Add existing user to site
wp user add-role username editor --blog-id=2

# Create user for specific site
wp user create siteuser [email protected] --role=editor --blog-id=2

Control site creation:

# Allow users to create sites
wp network option update add_new_users 1

# Restrict to Admins only
wp network option update add_new_users 0

Configure user limits:

# Maximum users per site
wp network option update users_can_register_blog 0

# Require email verification
wp network option update registrationnotification 'admin'

Theme and Plugin Management

Manage themes and plugins across Multisite network.

Network activate theme:

# Install and activate theme network-wide
wp theme install astra --activate --allow-root
wp theme enable-network astra

# List network-enabled themes
wp theme list --status=active --network

Create per-site theme overrides:

# WordPress automatically allows themes on individual sites
# Even if not network-enabled, they can be used per-site

# Switch theme for specific site
wp theme activate twentytwentythree --blog-id=2

Manage plugins network-wide:

# Network activate plugin
wp plugin install advanced-custom-fields-pro --activate --allow-root
wp plugin activate acf-pro --network

# List network plugins
wp plugin list --status=active --network

Create multisite-aware plugin configuration:

cat > /var/www/wordpress/wp-content/mu-plugins/multisite-config.php << 'EOF'
<?php
/*
Plugin Name: Multisite Configuration
Description: Network-wide settings and configurations
Network: true
*/

// Per-site configuration hooks
add_action('init', function() {
    // Global plugin configuration
    define('MY_GLOBAL_SETTING', 'value');
});

// Multisite-specific functionality
if (is_multisite()) {
    // Network activation hooks
    add_action('wpmu_new_blog', 'my_new_blog_setup');
    
    function my_new_blog_setup($blog_id) {
        // Configure new site
        switch_to_blog($blog_id);
        // Add site-specific setup
        restore_current_blog();
    }
}
EOF

Performance Optimization

Optimize WordPress Multisite for multi-site scale.

Implement Redis caching for network:

# Install Redis
sudo apt install redis-server -y
sudo systemctl start redis-server

# In wp-config.php add:
define('WP_REDIS_CLIENT', 'phpredis');
define('WP_REDIS_HOST', '127.0.0.1');
define('WP_REDIS_PORT', 6379);
define('WP_REDIS_DATABASE', 0);

Optimize database for Multisite:

# Create indexes for network tables
mysql -u root -p wordpress_db << EOF
-- Site lookups
CREATE INDEX idx_blog_path ON wp_blogs(path);
CREATE INDEX idx_blog_domain ON wp_blogs(domain);

-- User mappings
CREATE INDEX idx_usermeta_user_id ON wp_usermeta(user_id);
CREATE INDEX idx_usermeta_meta_key ON wp_usermeta(meta_key);

-- Options lookup
CREATE INDEX idx_options_option_name ON wp_options(option_name);
CREATE INDEX idx_blog_options_option_name ON wp_X_options(option_name);
EOF

Configure PHP-FPM for Multisite:

sudo nano /etc/php/8.2/fpm/pool.d/www.conf

Apply settings for multi-site:

pm = dynamic
pm.max_children = 64
pm.start_servers = 16
pm.min_spare_servers = 8
pm.max_spare_servers = 32
pm.max_requests = 10000

request_terminate_timeout = 300
request_slowlog_timeout = 10s

Monitor network health:

# Check site count
wp site list --count

# Monitor database size
mysql -u root -p -e "SELECT table_name, ROUND((data_length + index_length) / 1024 / 1024) AS size_mb FROM information_schema.tables WHERE table_schema = 'wordpress_db' ORDER BY size_mb DESC;"

# Monitor WP-Cron
wp cron test

Conclusion

WordPress Multisite provides powerful management capabilities for networks of related sites while maintaining a unified administration experience. Whether using subdomains for distinct brands or subdirectories for related content, proper configuration ensures scalability and performance. Understanding user permissions, theme/plugin management, and optimization techniques allows administrators to effectively manage complex networks. Strategic use of caching, database optimization, and proper Nginx configuration creates a robust platform supporting numerous interconnected WordPress sites serving diverse content and audiences.