Halloween DealsAmazon USHalloween week deals: useful picks before month-endAmazon US: current deals, useful picks and tech finds.Check DealsWindows FixRecommendedWindows errors stealing your time? Find the fix fastScan stability, cleanup and performance issues.Fix NowHalloween DealsAmazon USOctober picks are moving - compare before checkoutAmazon US: current deals, useful picks and tech finds.See Picks×
Skip to content
World desk13 min

How to Run Multiple WordPress Sites in Subdirectories with Nginx

A practical guide to running multiple WordPress sites at paths such as example.com/store with one Multisite installation and Nginx, including configuration, testing, and fixes for common routing failures.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

The reliable way to run several WordPress sites under paths such as https://example.com/site-a is a single WordPress Multisite installation configured as a subdirectory (path-based) network. The sites are virtual network paths, not separate folders containing separate WordPress copies. WordPress handles the network and site records; Nginx must pass ordinary files directly and route every other request to the shared index.php, while removing the site-path prefix from WordPress core and PHP endpoints.

This guide covers the activation sequence, the Nginx server block for WordPress 3.5-and-newer subdirectory networks, an alternative layout where one site’s core files really are stored in a filesystem subdirectory, and the checks that expose 404, redirect, PHP-FPM, and permissions errors.

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.

Choose the right subdirectory architecture first

Multisite subdirectory network

WordPress describes Multisite as “a way to host multiple WordPress sites on a single WordPress installation.” In a subdirectory network, the main site might be https://example.com/ and additional sites might be https://example.com/store and https://example.com/docs. WordPress calls this a path-based network: “A sub-directory install creates a path-based network, even though it does not use file system directories.” The words store and docs are network paths stored in WordPress, not directories that you create below the document root.

This is the architecture to use when several sites should share one WordPress codebase, one network administration layer, and one top-level domain. It also avoids the extra DNS work associated with assigning a separate hostname to every site. Plugins, themes, updates, backups, and permissions must still be managed with the impact on the whole network in mind.

#1 Best Overall
Sale
TOZO A1 Wireless Earbuds Bluetooth 5.3 Light Weight in Ear Headphones | IPX5 Waterproof,2 Mics for AI Calls,Immersive Premium Sound Bass Headset with Charging Case,32 EQ via App Black
  • [Ultra-Lightweight Ear Buds Designed for Small Ears] Each earbud weighs only 3.7g and features a compact, ergonomic in-ear design made especially for small ears. Secure, low-profile, and comfortable for workouts, all-day wear or overnight sleeping.The ultra-slim profile sits flush in your ear with no hard edges poking or rubbing, so you can even sleep on your side without discomfort.
  • [Immersive Stereo Sound with TOZO OrigX Technology] TOZO OrigX tuning delivers clear vocals, balanced mids, and natural stereo sound for music, podcasts, and videos.
  • [Long Battery Life for Daily Use] Get up to 7 hours of playtime on a single charge, with up to 32 hours total using the charging case—ideal for workdays, commuting, and extended listening sessions.
  • [Bluetooth 5.3 & Stable Connection] Bluetooth 5.3 provides fast pairing, stable wireless performance, and reduced dropouts as you move around home or office.
  • [Deep Bass with Clear Vocals] High-performance drivers produce punchy bass while keeping vocals clean and detailed for everyday listening.

A single site whose core is in a real directory

A different design places one site’s WordPress files in a directory such as /my_subdir while the public server location is higher in the tree. That is not Multisite. It does not create additional network sites; it changes where that site’s core files live. Its Nginx locations and WordPress constants are different from the network configuration in this article.

Signs that Multisite is not the right choice

  • Use separate installations when the sites need independent update, plugin, database, or administrator lifecycles that should not share a network.
  • Use a different network design when each site must have its own hostname and your organization is prepared to manage the DNS and domain behavior that entails.
  • Do not create empty filesystem directories for network paths as a substitute for the Multisite rewrite rules. Nginx will then serve a directory that WordPress never intended to represent a site.

Plan the deployment before editing Nginx

Record the values that must agree

Write down the canonical network domain, the path of the document root, the intended path for every site, the PHP-FPM upstream or Unix socket, the PHP version, and the TLS server block that terminates HTTPS. The examples below use example.com, /var/www/example.com/htdocs, and an upstream named php. Replace those values with the values on your host; do not copy them literally.

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

Decide whether Nginx is serving the same root for both HTTP and HTTPS and whether a separate redirect server block handles HTTP. The Multisite rules belong in the block that actually serves the WordPress document root. A perfectly written location in an unused server block cannot fix a 404.

Back up the site and database

Take a restorable backup of the existing files and database before enabling the network. Network activation changes configuration and adds network tables; a rollback is much easier when the original wp-config.php, uploads, and database dump are available. Test that the backup can be read before proceeding.

Rank #2
Sale
Smart Watch for Men Women Compatible with iPhone Samsung Android Phone 1.69 inch Full Touch Screen IP68 Waterproof Bluetooh Fitness Tracker Heart Rate/Sleep Monitor (Black)
  • 【IP68 Waterproof Multifunctinal Smart Watch】Torjalph fitness activity tracker smart watch is IP68 waterproof technology ,you can wear it when swimming,handwashing,it's rain-proof which means that you perform multiple exercise modes outside without worrying about sweat or rain corroding your fitness smart watch,and this watch equipped with a 230 mAh large capacity battery magnetic charging ,and this sports activity tracker watch can be used 5-7 days If fully charged.
  • 【Larger 1.83'' Full Screen Watch & Multi-dial Selection】1.83 inch full HD color touch screen smart watch for men / women provides excellent 240*284 resolution image quality ,This Bluetooth smart watch offers a better touch experience and remarkable immersion and ,more than 200 watch faces for you to choose from App"Da Fit ", you can change the dial style according to your mood to wear keeping the world on your wrist
  • 【Accurate Activity Tracker Smart Watch 】sports watch activity tracker uses sweat and dust resistant breathable silicone strap, our Fitness Tracker Smart Watch for Android iOS Phones supports 12 sports modes,walking,running,bicycle,swimming,badminton,basketball,football,rope skipping. This bluetooth calls smart watch for men women is lightweight and stylish, bringing more convenient and relaxing sports experience while also providing more protection.
  • 【Your 24 Hour Personal Daily Health Monitor】Fitness watch for women men full touch screen IP67 waterproof bluetooth smartwatch for Android iOS Phones with heart rate blood pressure monitor multifunction Andriod smart watch with steps counter sleep monitor sports fitness watch, monitoring blood oxygen saturation allows you to understand your physical condition in real time to track fitness progress ,to know your health status in time.
  • 【More Functions Bluetooth Call Smart Watch】This fitness activity smart watch full screen for iPhone and Android phones includes a bunch of new features including:The bluetooth smart watch can hang up the phone, receive and display WhatsAPP /Text /Facebook /Twitter /Messenger reminder.Support sedentary reminder, alarm clock, stopwatch, timer,weather information,music control, remote camera control compatible with Android 5.0 and above or iOS 9.0 and above smartphones.

Check access and versions

  • Use an account that can edit the main installation’s wp-config.php and the active Nginx configuration.
  • Confirm that the PHP-FPM service is running and that you know its socket path or configured upstream name.
  • Ensure the Nginx worker can read the document root and WordPress files, while uploads remain writable only where WordPress requires it.
  • Make sure the domain already resolves to this server and that the TLS certificate covers the network hostname.

Enable WordPress Multisite with subdirectory sites

  1. Back up first. Save the database, the current configuration, and the existing document root.
  2. Allow network setup. Edit the main installation’s wp-config.php and define WP_ALLOW_MULTISITE. WordPress’s Network Screen documentation requires this manual configuration before the network menu appears. Place the definition where your installation’s documentation instructs, before the file reaches its “stop editing” boundary.
  3. Open the network screen. Sign in to the main site’s dashboard and open Tools → Network Setup (the exact menu wording can vary slightly with the WordPress version and language).
  4. Select subdirectory sites. Choose the subdirectory option when WordPress offers the network address choice. The resulting network uses paths such as example.com/site-path, not separate hostnames.
  5. Apply the generated constants. WordPress displays constants and rewrite guidance tailored to the installation. Copy the displayed constants into wp-config.php exactly, preserving existing settings and PHP syntax.
  6. Apply the server guidance. Keep the generated values for the network domain and path. The Nginx block in the next section supplies the routing pattern; adapt its root and PHP-FPM details to your server rather than mixing Apache directives into Nginx.
  7. Sign in again. WordPress normally logs you out after network activation. Sign back in and confirm that My Sites → Network Admin is available.

The generated constants are authoritative for your network. If an admin URL later loses its site path or redirects in a loop, compare those constants with the network’s domain and path records before changing Nginx.

Use the Multisite subdirectory Nginx server block

Core configuration pattern

For WordPress 3.5-and-newer Multisite activated as subdirectories, the official Nginx handbook uses this pattern. Keep the ordering of the rewrites and locations; change only the server name, document root, and PHP-FPM connection details required by your host.

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

    if (!-e $request_filename) {
        rewrite /wp-admin$ $scheme://$host$request_uri/ permanent;
        rewrite ^(/[^/]+)?(/wp-.*) $2 last;
        rewrite ^(/[^/]+)?(/.*.php) $2 last;
    }

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

    location ~ .php$ {
        try_files $uri =404;
        include fastcgi_params;
        fastcgi_pass php;
    }
}

What each part does

  • server_name example.com selects the network hostname. Include any additional names only if they are intentionally configured and covered by TLS.
  • root /var/www/example.com/htdocs must be the directory containing the shared WordPress files, including index.php, wp-admin, and wp-includes.
  • index index.php gives directory requests a WordPress entry point.
  • The if (!-e $request_filename) block runs the network-specific rewrites only when the requested filesystem path does not already exist. The first rewrite adds a trailing slash to a bare /wp-admin request. The second strips an optional first path component from WordPress administration and other wp-* endpoints. The third strips that component from PHP paths. The last flag starts a new location lookup after the rewritten URI is created.
  • location / serves an existing file or directory directly. If neither exists, try_files sends the request to the shared front controller, /index.php?$args, while retaining the query string. This fallback is what lets WordPress resolve post and page permalinks for every network path.
  • location ~ .php$ prevents Nginx from handing a nonexistent PHP file to PHP-FPM. fastcgi_pass php is a placeholder for an upstream block or a socket; it is not a universal service name.

Adapt the PHP-FPM connection safely

If your host uses a Unix socket, replace fastcgi_pass php; with the socket path configured by that distribution and PHP version, such as the path shown by the host’s PHP-FPM service configuration. If it uses an upstream, define that upstream in the Nginx http context and use its name here. Do not guess a socket filename: a stale PHP 8.x path commonly produces a 502 response even when the WordPress files are correct.

The supplied pattern includes fastcgi_params. Keep the host’s required FastCGI parameters, and verify that the resulting SCRIPT_FILENAME points to the same document root used by Nginx. Distribution packages sometimes provide a different include file or set that parameter in a separate snippet; follow the active package conventions rather than declaring conflicting values.

Rank #3
New Bee Guitar Cable 10ft Electric Instrument Bass AMP Cord
  • [Low Noise High Fidelity] New bee guitar cord with 22AWG oxygen-free-copper center conductors provides enhanced signal transfer, the PVC insulation material and the high-density stranded copper double shield provide noise rejection for quiet operation
  • [Ideal for Choice] New bee 1/4 straight and right angle metal connectors, ensures a secure connection in any instrument, pedal, or amp jack. L shape great fro on stage guitar stands
  • [Wide Compatible] Suitable for mixer, power amplifier, microphone, effector, decoder, equalizer, electoronic organ, electric guitar, electric bass and other electronic equipments. Widely used in the installation of smart home, karaoke speaker, professional stage audio, etc
  • [Easy Disassemble] Making incidental repairs quick and easy! Very nice, flexible cable
  • [Dont Hesite to Order] 24 hours customer services and professional technology team are standing by

Keep reusable rules in include files

The official handbook recommends placing reusable restrictions and WordPress rules in include files, then including the appropriate Multisite subdirectory file from each site’s server block. This keeps deny rules, hidden-file protection, and network routing consistent. Treat those includes as configuration code: review them after package updates and confirm that a later location block has not overridden the intended PHP or static-file behavior.

Create network sites and verify their paths

  1. Open Network Admin → Sites → Add New.
  2. Enter the site’s network path, title, and administrator email. The path is the part after the network domain, for example store for https://example.com/store.
  3. Save the site and open its edit screen. Confirm that the network domain and path combine to the exact public URL you planned.
  4. Visit the new site’s dashboard, select a theme if required, and configure its settings from that site’s admin context.
  5. Repeat with a second site only after the first site has passed front-end, permalink, admin, and asset checks. A typo in the path can be corrected, but links and bookmarks may already have propagated.

Do not create /store or /docs directories merely to make those URLs exist. A real directory can intercept Nginx’s file check and bypass the network route, producing behavior that looks like a permissions or rewrite problem.

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

Validate Nginx and the complete request flow

Check syntax before reloading

  1. Run nginx -t with the same privileges and configuration path used by the service manager.
  2. Resolve every syntax error, duplicate directive, missing include, and unknown upstream before touching live traffic.
  3. Reload Nginx only after the test succeeds. A reload applies the new workers without requiring a full stop; use the service manager appropriate to your operating system.

Test both the root site and a subsite

Use a browser or command-line HTTP client and record the status code, final URL, and response body for each request below. Test over HTTPS if that is the public scheme.

Request Expected result What it proves
Main-site home page Loads at the canonical network URL The server block, TLS, document root, and base WordPress installation agree.
Subsite home page, for example /store/ Loads without falling back to the main site The network path is recognized and reaches WordPress.
A subsite post permalink Returns the post rather than a 404 The try_files front-controller fallback is active.
/store/wp-admin/ Shows the correct subsite login or dashboard The path-prefix rewrites and trailing-slash handling work.
A static CSS or JavaScript asset Returns the asset with a non-PHP content type Existing files are served directly and are readable.

After any configuration change, reload Nginx and repeat the root-site and subsite checks. Also inspect the Nginx error log and PHP-FPM log at the time of a failing request; the first error is generally more useful than a browser’s generic status page.

Rank #4
BSIMB 15.6" Digital Family Calendar & Chore Chart, No Subscription Fees
  • Digital Family Calendar: BSIMB digital calendar wall touch screen puts an end to your chaotic life. Designed for busy families, the digital calendar keeps you organised and in step with your family. Assign different colours and tasks to each family member to make family scheduling easier and more intuitive.
  • Easy Setup and Auto-Sync: Plug in, connect to WLAN and auto-syn your electric calendar in minutes. Digital wall calendar compatible with Google calendar, iCloud calendar, Outlook calendar, Cozi calendar and Yahoo calendar. Add events directly on the device or through the ecalendar app. Electronic calendar stays current whether you're at work or traveling—no manual updates needed.
  • All-In-One Home Assistant: Smart calendar builds habits and encourage independence with personalised chores. Display daily meal plan to reduce the daily ‘What's for dinner?’ stress. To-do lists keep track of everything you want. Turning chores into valuable achievements with stars and rewards, making life easier and more enjoyable.
  • Manage Anytime Anywhere: BSIMB electronic calendar for family stay connected with the powerful ecalendar app. Access and manage your digital wall calendar anytime, anywhere with free features like stars & rewards, photo screensaver, chore charts, meals plans, to-do lists etc. Electronic planner paid features like Magic Import tailor advanced tools for users with special needs.
  • Stay in Touch with Loved Ones: Share photos or videos from your phone to electronic wall calendar with app, instantly update your life moment, and keep in touch with your family, especially those who are far away; you can also surprise your smart calendar digital wall by sending him a wish card; it's also great for keeping tech-illiterate elders in touch with the youngsters.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Fix the common failure modes

Every subsite permalink returns 404

This usually means the request never reaches /index.php?$args or the Multisite rewrite block is absent, out of order, or installed in a different server block. Confirm the document root, ensure the location / block contains the exact fallback, and retain the three rewrites inside the non-existing-file check. Test a known post URL on the main site and a subsite to distinguish a global front-controller problem from a path-prefix problem.

The main site works but the subsite shows the main site’s content

Check the site’s domain and path values in Network Admin. Then inspect for a physical directory with the same name as the network path, an alternate server block matching the hostname first, or a rewrite that removes too much of the URI. The subdirectory prefix must be removed only for the WordPress core and PHP endpoints covered by the official pattern; ordinary site requests need to reach the shared front controller with their original path.

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

PHP downloads as text or returns 502

A download indicates that the request did not enter the PHP location, often because a more specific location or an incomplete include is taking precedence. A 502 usually indicates that Nginx cannot connect to the PHP-FPM upstream or socket. Verify that PHP-FPM is running, that the socket exists and is accessible to the Nginx worker, and that the configured PHP version matches the socket name. Run nginx -t after correcting the block, reload, and test a small PHP-backed WordPress request rather than exposing a diagnostic file publicly.

Admin URLs loop, lose the path, or gain a duplicate path

Compare the generated WordPress network constants with the network domain and path stored in Network Admin. A wrong scheme, domain, or path can make WordPress redirect forever even when Nginx routing is correct. Check rewrite order next: the /wp-admin trailing-slash rule must precede the rules that strip the optional subsite component. Clear browser redirects only after correcting the server and WordPress values, otherwise cached 301 responses can hide the fix.

Only CSS, JavaScript, or images fail

Check the asset URL in the browser’s network panel and confirm that the file exists below the document root with readable permissions. If the URL points to an old domain or omits the subsite path, correct the network’s URL settings and regenerate cached assets as appropriate. Do not make the entire uploads tree executable; static files should be readable, while PHP execution in user-uploaded directories should be blocked according to your host’s normal restrictions.

Changes appear to have no effect

You may have edited a file that Nginx does not include, or reloaded a different instance than the one serving traffic. Use the active configuration dump and service status tools provided by your operating system to identify the loaded server block, then make one small change, run nginx -t, reload, and retest. Keep a dated change record so a later include-file update does not silently undo the working rules.

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 WordPress core really lives in a subdirectory

If you intentionally store a single site’s core in /my_subdir, use the layout documented by WordPress for that case rather than the Multisite pattern:

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

location ~ .php$ {
    fastcgi_split_path_info ^(.+.php)(/.*)$;
    fastcgi_pass unix:/var/run/php/php8.3-fpm.sock;
    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    include fastcgi_params;
}

Here, /my_subdir/ is a real filesystem and URL location, and the fallback points to /my_subdir/index.php. The example socket is specifically a PHP 8.3-style path; your distribution may use another PHP version or a different directory. The fastcgi_split_path_info directive handles a PHP script followed by path information. This layout does not create a second network site, so do not combine it casually with the Multisite rewrites above. Choose one architecture, then make the WordPress constants, document root, locations, and PHP parameters describe that same architecture.

Subdirectory Multisite versus subdomain Multisite

Both modes use one Multisite installation, but they expose different public URLs and operational boundaries. WordPress’s Nginx handbook provides separate examples for each mode. The path-based option covered here has these practical characteristics:

Decision area Subdirectory network Subdomain network
Public URL example.com/site-path A separate hostname such as site.example.com
DNS work Additional sites reuse the network hostname, so no per-site hostname records are normally required. Hostnames require DNS planning and certificates that cover the names you publish.
Branding The network domain remains visible in every site’s path. Each site can present a distinct hostname.
Cookie and domain behavior Requests share one parent host; verify login and cookie scope against the network constants. Cookie scope and cross-host behavior must be reviewed for the chosen domain arrangement.
Nginx routing Requires the path-prefix rewrites and front-controller fallback shown in this guide. Uses hostname-based server selection and the separate subdomain rules.
Migration impact Changing a site’s path changes links and bookmarks while retaining the network host. Changing a site’s hostname affects DNS, certificates, and host-based URLs.

Choose based on the URL and administration model you can operate consistently. Do not switch modes by editing only Nginx; WordPress’s network setup and constants must be changed together.

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

Security and maintenance requirements

  • Keep WordPress, themes, plugins, Nginx, and PHP-FPM patched. A shared codebase means a vulnerable component can affect every site in the network.
  • Apply the host’s normal Nginx restrictions for hidden files, configuration files, backups, and other sensitive artifacts. Never make wp-config.php downloadable.
  • Verify ownership and permissions after migrations or restores. Nginx needs read access to code and static files; WordPress needs write access only to the directories and operations your deployment permits.
  • Protect uploads from unintended PHP execution and monitor unusual file creation. A writable directory should not automatically become an executable directory.
  • Back up the database and the shared files on a schedule, and test restoring one subsite and the network metadata rather than assuming a file copy is sufficient.
  • Document the active server block, include files, PHP-FPM endpoint, network domain, and every site’s path. This short inventory speeds recovery when a package update changes a socket name or include path.

Operational checklist

  1. Confirm the network domain, document root, PHP-FPM endpoint, TLS configuration, and intended site paths.
  2. Back up files and the database.
  3. Define WP_ALLOW_MULTISITE, run Network Setup, select subdirectories, and apply the generated constants.
  4. Install the Multisite Nginx pattern with your real root and PHP-FPM values.
  5. Run nginx -t; reload only after it succeeds.
  6. Create one subsite and verify its home page, post permalink, admin URL, and static assets.
  7. Review logs and permissions, then add additional sites.
  8. Repeat the tests after every Nginx, PHP-FPM, WordPress, domain, or path change.

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 *

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.

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.