October DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsPC HealthRecommendedCrashes, freezes, slowdowns? Check your PC nowSpot repairable issues before they interrupt work.Check PCOctober DealsAmazon USDeal season is back - check today's better picksAmazon US: current deals, useful picks and tech finds.See Picks×
Skip to content
World desk12 min

How to Set Up WordPress Multisite with Nginx (Subdomains, Subdirectories, DNS and SSL)

A practical, end-to-end guide to WordPress Multisite on Nginx, covering URL structure choices, generated configuration, PHP-FPM rewrites, wildcard DNS, HTTPS, mapped domains and post-install testing.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

To run WordPress Multisite on Nginx, prepare and back up the existing site, enable the network in WordPress, copy the generated constants into wp-config.php, and install the matching Nginx server rules yourself. Nginx does not read .htaccess, so WordPress cannot create those rewrites automatically.

Choose subdirectories when you want sites such as example.com/site1 with no additional DNS records. Choose subdomains for addresses such as site1.example.com, but plan wildcard DNS, a wildcard Nginx server name and certificates that cover the hostnames. The procedure below covers both models, mapped domains, PHP-FPM, validation and the failures most often seen after migration.

As an Amazon Associate I earn from qualifying purchases.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

What you need before creating the network

Multisite changes the database, URL routing and administration model of an existing WordPress installation. Treat network creation as a change that needs a rollback plan rather than as a plugin toggle.

  • A working single-site WordPress installation served by Nginx and PHP-FPM.
  • Shell or control-panel access to edit the active Nginx server block and wp-config.php.
  • Permission to reload Nginx and to create or edit DNS records.
  • A database dump and a copy of the WordPress files stored outside the web root or on another system.
  • A hostname that resolves to the server. A subdomain network cannot use an IP address or localhost.

Back up the database and files

WordPress’ network-creation guide warns that, unless the installation is fresh and disposable, you should back up both the database and files. Use your hosting provider’s backup tool or equivalent commands, and verify that the resulting files can actually be read.

mysqldump -u DB_USER -p DB_NAME > wordpress-before-multisite.sql
tar -czf wordpress-files-before-multisite.tar.gz /var/www/example

Replace the example database, user and path with the values used by your installation. Keep the dump and archive off the server if possible. A backup that remains on the same disk does not protect you from a disk failure or an incorrect restore.

Confirm pretty permalinks

In the WordPress dashboard, open Settings > Permalinks, select a structure other than Plain, save it and open several posts. Confirm that the front end, an individual post and the login page all work without query-string-only URLs. Multisite relies on the same front-controller routing, so a broken single-site permalink setup should be fixed before the network is created.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Deactivate active plugins

Deactivate the currently active plugins before opening Tools > Network Setup. Plugins that alter login cookies, rewrite URLs, cache pages or create custom database tables can interfere with the one-time network conversion. Record which plugins were active so you can reactivate and test them individually after the network is stable.

Decide whether WordPress belongs in its own directory

The Network Setup screen uses the installation’s current location when it generates paths. If you intend to move WordPress from the document root into a directory, make that decision before enabling Multisite. Moving the files and changing addresses afterward adds another migration to an already changed database.

Subdomains or subdirectories?

The choice determines the public URL format and much of the DNS and certificate work. It is not a cosmetic switch that can be changed later by editing one constant.

Decision factor Subdirectories Subdomains
Example site URL example.com/site1 site1.example.com
Extra DNS records Normally none; the parent host already resolves. Wildcard DNS for the parent domain is required so newly created sites resolve.
Nginx hostname The primary hostname, such as example.com. The primary hostname plus a wildcard, such as example.com *.example.com.
Certificates The certificate only needs to cover the parent hostname unless you add mapped domains. The certificate must cover the wildcard names you will serve, or each hostname must have its own certificate.
Branding All sites visibly share one host and path. Each site can present a separate host-like address.
Existing paths Can conflict with directories or URL paths already used by the single site. Avoids many path conflicts, but adds DNS and certificate dependencies.

When subdirectories are the safer choice

Use subdirectories when every site belongs clearly under one domain and you do not want to maintain wildcard DNS. A new site can be available as soon as WordPress creates it because the request still reaches the existing parent host. Check your existing URL paths first: a directory or rewrite that already owns a name can collide with a site slug.

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

When subdomains are worth the extra infrastructure

Use subdomains when site separation is important to users or branding. Before testing a newly created site, publish a wildcard DNS record for the parent domain and configure Nginx to accept wildcard hostnames. A subdomain network is not supported on an IP address or on localhost.

Do not switch models by changing one constant

WordPress documents that changing only SUBDOMAIN_INSTALL and the rewrite rules does not convert a live network. The stored site addresses, database values and web-server configuration also have to be changed. Plan a migration with a database and file backup instead of treating the setting as reversible.

Enable Multisite in WordPress

  1. Open wp-config.php in the directory that contains the WordPress core files.
  2. Insert the following line above the comment that says to stop editing:
define( 'WP_ALLOW_MULTISITE', true );
  1. Save the file and sign in to the dashboard again.
  2. Open Tools > Network Setup.
  3. Select Sub-domains or Sub-directories. WordPress may restrict the available choice when the existing installation’s age, URL structure or site paths make one model unsafe.
  4. Enter the network title and network administrator email, then choose Install.

The screen that follows displays the exact constants and cookie settings for this installation. Keep that screen open. Values such as the current domain, path and generated salts must match the installation; do not replace them with a generic block copied from another server.

Apply the generated wp-config.php values

After network creation, WordPress displays a second set of instructions. Copy the complete block shown by your dashboard into wp-config.php, placing it where WordPress specifies. A typical network contains constants similar to these, but your generated domain, path and subdomain flag are authoritative:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
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 );

The example uses subdirectories because SUBDOMAIN_INSTALL is false. A subdomain network normally receives true and may include additional values in the generated block. Use the dashboard’s exact output, including any COOKIE_DOMAIN or other line it provides, rather than assuming that the abbreviated example is complete.

Save the file, sign out and back in if WordPress requests it, and open My Sites in the admin bar. If the menu is missing, check that the constants were inserted in the correct file and that PHP can read the file.

Creating the network with WP-CLI

WP-CLI can create the network tables and write the required constants. From the WordPress installation directory, run:

wp core install-network --subdomains

The --subdomains option selects a subdomain network. Omit that option when you intend to create a subdirectory network, and review the command’s generated instructions before editing wp-config.php. The same DNS and Nginx requirements still apply; WP-CLI does not configure your web server.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Configure Nginx for WordPress Multisite

Nginx has no .htaccess-style per-directory configuration. WordPress therefore cannot modify Nginx or generate the rewrite rules for you. Install the rules in the server block that serves the WordPress document root, then validate the configuration before reloading it.

The examples below are patterns, not drop-in values. Replace /var/www/example with the real document root and replace the PHP-FPM socket with the version and path installed on your server. Keep one active PHP location; duplicate or conflicting regular-expression locations can send requests to the wrong handler.

Common PHP-FPM handler

Both network models need a front controller and a PHP location that rejects missing scripts. The try_files $uri =404 check prevents Nginx from passing arbitrary nonexistent paths to PHP.

location ~ .php$ {
    try_files $uri =404;
    include fastcgi_params;
    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    fastcgi_param HTTP_PROXY "";
    fastcgi_pass unix:/run/php/php8.2-fpm.sock;
}

Use the socket shown by your PHP-FPM service; it may be a different PHP version or a TCP endpoint. The important checks are that the socket exists, the Nginx worker can access it and the PHP-FPM pool is running.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Subdirectory server block

A subdirectory network sends site paths through the same parent hostname. The front-controller rule is:

server {
    listen 80;
    server_name example.com;
    root /var/www/example;
    index index.php;

    location / {
        try_files $uri $uri/ /index.php?$args;
    }

    location ~ ^/wp-admin$ {
        rewrite ^ $scheme://$host$uri/ permanent;
    }

    location ~ ^(/[^/]+)?/wp-.*.php$ {
        rewrite ^(/[^/]+)?(/wp-.*.php)$ $2 last;
        try_files $uri =404;
        include fastcgi_params;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        fastcgi_param HTTP_PROXY "";
        fastcgi_pass unix:/run/php/php8.2-fpm.sock;
    }

    location ~ .php$ {
        try_files $uri =404;
        include fastcgi_params;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        fastcgi_param HTTP_PROXY "";
        fastcgi_pass unix:/run/php/php8.2-fpm.sock;
    }
}

The /wp-admin redirect adds the trailing slash expected by the administration area. The /wp-.* rewrite handles core requests that contain a site path, while try_files $uri $uri/ /index.php?$args sends ordinary posts, pages and site slugs to WordPress.

Use the separate subdirectory example from the WordPress Nginx handbook when your WordPress version or existing server block contains additional locations for media, caching or security. Do not paste two competing sets of rewrite rules into one server block.

Subdomain server block

A subdomain network needs a server name that accepts both the parent host and arbitrary first-level subdomains:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
server {
    listen 80;
    server_name example.com *.example.com;
    root /var/www/example;
    index index.php;

    location / {
        try_files $uri $uri/ /index.php?$args;
    }

    location ~ ^/wp-admin$ {
        rewrite ^ $scheme://$host$uri/ permanent;
    }

    location ~ .php$ {
        try_files $uri =404;
        include fastcgi_params;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        fastcgi_param HTTP_PROXY "";
        fastcgi_pass unix:/run/php/php8.2-fpm.sock;
    }
}

The wildcard in server_name only tells Nginx which requests to accept; it does not create DNS records. The parent domain and wildcard DNS record must point to the same server, and the TLS certificate must cover the names when HTTPS is enabled.

Validate and reload safely

  1. Save the server-block file in the location included by your Nginx configuration.
  2. Run nginx -t. Fix every syntax or include-file error before proceeding.
  3. Reload only after the test succeeds: systemctl reload nginx.
  4. Check PHP-FPM status and its error log if PHP pages return a gateway error.

A reload applies the new configuration without stopping existing workers. A failed configuration test leaves the running configuration in place, which is why testing first matters.

Set up DNS and HTTPS

Wildcard DNS for subdomains

Create a wildcard record for the parent domain, such as an A record for *.example.com pointing to the server’s address. Keep the parent example.com record as well. DNS providers differ in how they label wildcard records, so confirm the provider’s syntax and wait for the record’s TTL to expire before diagnosing WordPress.

Test both an existing hostname and a newly invented one. If site1.example.com works but a newly created site does not resolve, the problem is usually DNS propagation or a missing wildcard record rather than a WordPress rewrite.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

HTTPS for the network

Install a certificate for the primary hostname before forcing HTTPS in WordPress. For subdomain networks, use a certificate that covers the wildcard hostnames you will serve or provision certificates for each name. Nginx must have a TLS server block whose server_name matches the requested host.

When several HTTPS domains share one address, Server Name Indication (SNI) lets Nginx select the certificate for the hostname supplied by the browser. Verify that the certificate, redirect rules and WordPress site address all use the same scheme and hostname; mixed HTTP/HTTPS values commonly produce redirect loops or insecure media warnings.

Mapped domains

WordPress has native domain mapping from version 4.5 onward. A mapped site can use a separate domain instead of the network’s normal subdirectory or subdomain address, but the domain must resolve to the same installation and be represented in Nginx. Provision SSL for the primary domain and use SNI for each additional mapped domain.

Add the mapped hostname to the appropriate Nginx server_name list or create a dedicated server block with the same document root and PHP handler. Then set the site’s address in the network administration screens and test front-end links, login cookies and administrative redirects on the mapped hostname.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Finish the network in the dashboard

  1. Open Network Admin > Sites > Add New and create a test site with a short, unique address.
  2. Visit the new site’s front page, one post, the login URL and /wp-admin/.
  3. Upload an image from the site dashboard and confirm that it appears in the media library and on the front end.
  4. Open Settings > Permalinks for the site and save without changing the structure, then retest a post URL.
  5. Reactivate plugins one at a time. After each activation, test login, the network dashboard, a site dashboard and a cached or rewritten URL.

Network-activated plugins run across sites, while site-activated plugins apply only to one site. Keep that distinction in mind when a feature appears unexpectedly or when a plugin’s settings page is missing from an individual site.

Troubleshooting checklist

Symptom Likely cause What to check
Every post or page returns 404, but the home page works. The front-controller rule is missing or the wrong server block was reloaded. Confirm try_files $uri $uri/ /index.php?$args;, run nginx -t, reload Nginx and verify the request’s hostname selects the intended block.
A subdomain does not resolve. No wildcard DNS record, stale DNS cache or an incorrect record target. Query the hostname with your DNS tools and compare it with the server address. Test a newly invented subdomain to distinguish DNS from WordPress routing.
The browser shows the wrong certificate. The TLS server block or certificate does not match the requested hostname. Check the certificate’s names, the wildcard coverage and SNI server selection. Ensure the HTTPS block has the same wildcard server_name.
PHP files download or return 502. PHP location or PHP-FPM socket is wrong, or the service is stopped. Check fastcgi_pass, socket permissions, PHP-FPM status and Nginx’s error log. Keep try_files $uri =404 inside the PHP location.
/wp-admin redirects repeatedly. HTTP and HTTPS site addresses disagree, or a proxy adds conflicting redirect headers. Compare the network and site URLs, the Nginx redirect and any load-balancer HTTPS header. Test one scheme consistently.
Media uploads fail or show broken URLs. The upload path, site address or multisite rewrite is inconsistent. Check the generated network constants, the document-root permissions, the media URL and the Nginx locations that handle uploads.
The Network Admin menu is absent. The generated constants were not copied correctly or were placed in another configuration file. Open the active wp-config.php, confirm MULTISITE and the other generated values, and check PHP’s view of the loaded file.
Changing SUBDOMAIN_INSTALL changes nothing. The database addresses and server configuration still describe the old model. Restore the backup if needed and plan a complete URL migration; do not rely on the constant alone.

Operational practices after setup

Back up at the network level

Sites in one network share the WordPress codebase and network database tables, so a mistake can affect every site. Schedule database backups and file backups, retain multiple restore points and periodically test restoring them to a separate environment.

Keep Nginx rules under change control

Record the active server block, document root, PHP-FPM endpoint, DNS records and certificate names. When a hosting provider changes the PHP version or socket path, update the configuration deliberately and run nginx -t before reloading.

Separate network and site administration

Use the Network Admin area for users, themes, plugins and global settings. Use each site’s dashboard for content and site-specific settings. Grant site administrators only the permissions they need, especially when several organizations share the network.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Plan migrations before changing URL structure

Moving from subdirectories to subdomains, changing the primary domain or adding mapped domains affects stored addresses, redirects, cookies, DNS, certificates and Nginx host matching. Schedule the change, lower DNS TTL in advance where appropriate, retain the old addresses during the redirect period and keep the pre-change backup until every site and login path has been verified.

Final verification before inviting users

  • The main domain and every intended subdomain or mapped domain resolve to the server.
  • HTTPS presents the correct certificate for each hostname.
  • The home page, a pretty permalink, /wp-login.php and /wp-admin/ load without loops.
  • A newly created site can be opened, edited and reached through its final URL.
  • Media uploads work and uploaded files are served from HTTPS.
  • Plugins are reactivated and tested rather than enabled all at once.
  • A fresh database dump and file archive exist, and the restore procedure is known.

Once these checks pass, Nginx is routing all network sites through WordPress’ front controller, DNS and certificates cover the URL model you selected, and the network can be expanded without repeating the initial server work.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Leave a Reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
Windows Errors? Fix Them Before They SpreadFree repair scan
Outdated Drivers Are Slowing You DownFree scan - exact matches

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.