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 desk11 min

How to Run Two WordPress Sites Under One Domain with NGINX

A practical NGINX guide to hosting two WordPress sites under one domain, including Multisite versus standalone installs, PHP-FPM routing, reverse proxies and troubleshooting.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Yes. Put both sites behind one NGINX server block, give the first site the root path (/) and route the second to a distinct path such as /site2/. Each application needs a front-controller fallback to its own index.php. Choose WordPress Multisite if the sites should share a network, core files and administration; choose two standalone installations when you need separate databases, plugins, updates, backups or failure boundaries. If the applications run on different machines or containers, use NGINX as a reverse proxy instead of a shared local document root.

Choose the architecture before changing NGINX

The URL design determines the WordPress design. A single domain can expose multiple path-based sites, but those paths must map unambiguously to separate WordPress request handlers. Decide whether the second site is a Multisite subsite, an independent installation in a subdirectory, or an application on another upstream server.

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.
Decision area WordPress Multisite Two standalone installations Separate upstream applications
Administration One network dashboard with site-level administration Separate dashboards and credentials Separate dashboards; NGINX only routes traffic
Code and updates Shared WordPress core and network-managed plugins or themes Independent core, plugin and theme versions Independent code on each upstream
Data isolation Network tables and shared infrastructure Separate databases and filesystem trees Separate databases and servers or containers
Typical public URL example.com/subsite, with optional domain mapping later example.com/site2 example.com/site2 at the proxy, with the upstream configured for that public path
Failure and backup scope A network-wide change can affect every site; backups must cover the network Each installation can be restored on its own schedule Failures can be isolated by upstream, although the shared proxy remains a dependency
Server access Required for NGINX rules and reloads Required for NGINX rules, PHP-FPM and filesystem permissions Required for proxy configuration and upstream connectivity

Use Multisite when the sites are one network

WordPress Multisite creates a path-based network in which a site can live at a URL such as example.com/subsite. It is appropriate when one team wants network administration, a shared WordPress core and centrally managed themes or plugins. Network administrators can create sites and manage common settings from one installation.

Multisite is not simply a second copy of WordPress in a folder. Converting an existing single site changes database behavior, user roles, network settings and the way uploads are stored. Confirm that every required plugin supports Multisite, decide which users are network administrators versus site administrators, and test network-wide backups before conversion. NGINX also needs the more involved subdirectory rules described in the official WordPress NGINX guidance; the ordinary single-site fallback alone is not sufficient for every network path.

#1 Best Overall
Elebase USB to USB C Adapter for iPhone 18 Pro Max,USBC Car Charger Adapter | 4Pack Type C Female to A Male Cable Converter for Apple Duo 17 16 15 14 Plus,iWatch Watch 12 11 10,iPad 9 8 Air,Airpods 5 4
  • Read Before You Buy — No Video Output: These adapters support charging and USB 2.0 data transfer, but cannot transmit video signals. Except for standard USB webcams (which use USB data only), they are not compatible with HDMI/DisplayPort cables, video-capable USB-C hubs, or docking stations with video output.
  • Convert USB-A Ports to USB-C: Designed to connect USB-C earphones, cables, flash drives, card readers, and other USB-C accessories to standard USB-A ports. Plug-and-play with no drivers or software required.
  • Aluminum Alloy Housing: Built with a sturdy aluminum alloy shell that aids in heat dissipation and protects against daily wear and scratches. Designed to maintain a stable and secure connection.
  • Compact & Travel-Friendly: The ultra-compact design allows the adapter to stay plugged into your device without blocking adjacent ports or adding bulk, reducing wear and tear on your original USB ports.
  • 12-Month Warranty: Backed by a 12-month manufacturer warranty for peace of mind. Designed to meet strict quality control standards for reliable everyday performance.

Use standalone installs when isolation matters

Two standalone installations are easier to reason about when the sites need different plugins, release schedules, PHP requirements, credentials or recovery points. The first installation can remain at the document root, while the second lives in a directory such as /var/www/example.com/site2 and has its own database. A plugin failure, update or compromise in one installation is less likely to alter the other, although both still share the host, NGINX and PHP-FPM unless you separate those services.

Use separate upstreams for server or container boundaries

If each site runs on its own virtual machine, container or internal web server, let the public NGINX instance reverse-proxy the path to the appropriate upstream. This keeps application files and runtime processes separate, but it introduces proxy concerns: the upstream must understand the public host and path, redirects must remain public, and cookies and cache keys must not leak between sites.

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

Plan paths, files and URLs

Use one canonical scheme and host, for example https://example.com. Decide the second path before installing WordPress; changing it later requires URL and rewrite changes and can leave serialized settings or cached links behind.

  • Keep the first site’s files under the NGINX document root, such as /var/www/example.com.
  • Place the standalone second site under a child directory, such as /var/www/example.com/site2, or route /site2/ to a separate upstream.
  • Give a standalone second site a separate database and database credentials.
  • Set the second site’s WordPress Address and Site Address to the public URL, for example https://example.com/site2. Both values should include /site2 when WordPress files and the public home are in that path. Do not add a second, conflicting host or scheme.
  • Record the exact PHP-FPM socket, document-root path, ownership and log locations supplied by your host. These values differ by operating system and PHP version.

Configure two local WordPress installations with NGINX

The following pattern assumes one server, one document root, PHP-FPM and a standalone second installation in site2. Replace the filesystem paths and PHP socket with values that exist on your server.

Rank #2
Sale
Anker USB-C Hub, 5-in-1 USB Hub for Laptops, 4K HDMI Multiport Adapter | USB C Dongle with 90W Max Power Delivery, 3×5Gbps USB A Data Ports, for MacBook, Dell, and More (Charger Not Included)
  • 5-in-1 USB-C Hub: Experience comprehensive connectivity featuring a Power Delivery input, two USB-A 2.0 ports, a USB-A 3.0 port, and an HDMI port. (Note: The USB-C power delivery input port is only for connecting an external wall charger to power your laptop and cannot power peripheral devices.)
  • 90W Pass-Through Charging: Achieve optimal charging with 90W pass-through power to your laptop, supported by a total input of 100W, with the hub reserving 10W for operational efficiency. (Note: Wall charger not included.)
  • Quick Data Transfers: Accelerate your productivity with rapid data transfers using a high-speed 5Gbps USB 3.0 port and two 480Mbps USB 2.0 ports.
  • 4K HDMI Display: Enhance your visual experience with a hub capable of delivering 4K resolution at 30Hz in both mirror and extend modes. Please note that this hub is compatible with MacBook (macOS 12 and newer), Windows 10 and 11, ChromeOS, and laptops equipped with DP Alt Mode and Power Delivery. Note: This device is not compatible with Linux.
  • What You Get: Anker USB-C Hub (5-in-1, 4K HDMI), welcome guide, 18-month warranty, and our friendly customer service.
server {
    listen 80;
    server_name example.com;
    root /var/www/example.com;
    index index.php;

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

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

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

What each location does

  • root points NGINX at the first site’s files. Because site2 is beneath that root, /site2/index.php resolves to the second installation.
  • The /site2/ prefix is more specific than /, so requests for the second site are tested against its own files first. Missing pretty-permalink requests are sent to /site2/index.php, not the root site’s front controller.
  • The root location performs the same operation for the first site, falling back to /index.php.
  • The PHP location refuses a script that does not exist with try_files $uri =404 before handing it to FastCGI. This prevents arbitrary paths from being executed as PHP.
  • fastcgi_param SCRIPT_FILENAME combines the server root and requested script path. Check that this produces the real path for both /index.php and /site2/index.php.

NGINX evaluates location specificity rather than treating configuration like a sequence of directory files. Keep the dedicated /site2/ block distinct from generic routing and check for other regular-expression locations that could intercept PHP requests. If your existing configuration has a PHP, cache or security block, merge these rules deliberately rather than creating competing server blocks for the same host.

Install the second standalone site

  1. Create the site2 directory and place a complete WordPress installation inside it. Ensure the NGINX worker and PHP-FPM process can read the files and write only the directories that WordPress actually needs.
  2. Create a database and database user dedicated to the second installation. Enter those credentials in the second site’s configuration; do not reuse the first site’s database unless you intentionally chose Multisite.
  3. Open https://example.com/site2 and complete the WordPress installer. If the installer redirects to the root domain or removes /site2, stop and correct the URL settings before creating content.
  4. In the second site’s General Settings, verify that both WordPress Address (URL) and Site Address (URL) use the same HTTPS host and the /site2 path. A deliberate separation between the files URL and the home URL is possible, but it should be a conscious design, not an accidental mismatch.
  5. Save permalinks after the site is reachable. This makes WordPress generate links for the intended path, while NGINX remains responsible for routing those links.

Configure a WordPress Multisite subdirectory network

A Multisite network at example.com can create a subsite at example.com/subsite. Enable Multisite using WordPress’s documented network-setup procedure, choose subdirectory addresses, and follow the generated network constants and rewrite instructions exactly. The network’s NGINX configuration is more complex than the standalone example because administrative paths, network PHP requests and subsite routing all need to reach the main WordPress front controller correctly.

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

Do not copy the standalone /site2/ block and assume it creates a working network. The official WordPress NGINX guide’s Multisite subdirectory pattern includes handling for paths such as /wp-admin, /wp-* and PHP requests, with a try_files fallback to /index.php?$args. Apply that pattern at the server level and adapt only the documented domain and filesystem values. NGINX has no directory-level equivalent of Apache’s .htaccess or IIS’s web.config; WordPress cannot write these rules for you.

  • Test creation and access of a second subsite before importing production content.
  • Check that media uploads use the expected network path, including wp-content/uploads/sites/ for site-specific uploads.
  • Review network plugin compatibility and user roles before activating anything network-wide.
  • Back up the network database and files together. A single network-wide change can affect every subsite.

Reverse-proxy the second site to another application

When the second WordPress installation is not on the public server, route its path to an upstream service. A conceptual NGINX location is:

Rank #3
Sale
Anker USB C Hub, 7in1 Multi-Port USB Adapter, 4K@60Hz USBC to HDMI Splitter | 85W Max PD, 2 USB 3.0 & 1 USBC Data Ports, SD/TF Card Reader, for Laptops/Mac and Other Type C Devices (Charger Not Included)
  • Sleek 7-in-1 USB-C Hub: Features an HDMI port, two USB-A 3.0 ports, and a USB-C data port, each providing 5Gbps transfer speeds. It also includes a USB-C PD input port for charging up to 100W and dual SD and TF card slots, all in a compact design.
  • Flawless 4K@60Hz Video with HDMI: Delivers exceptional clarity and smoothness with its 4K@60Hz HDMI port, making it ideal for high-definition presentations and entertainment. (Note: Only the HDMI port supports video projection; the USB-C port is for data transfer only.)
  • Double Up on Efficiency: The two USB-A 3.0 ports and a USB-C port support a fast 5Gbps data rate, significantly boosting your transfer speeds and improving productivity.
  • Fast and Reliable 85W Charging: Offers high-capacity, speedy charging for laptops up to 85W, so you spend less time tethered to an outlet and more time being productive.
  • What You Get: Anker USB-C Hub (7-in-1), welcome guide, 18-month warranty, and our friendly customer service.
location /site2/ {
    proxy_pass http://wordpress_site2/;
    proxy_set_header Host $host;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header X-Forwarded-Proto $scheme;
}

The trailing slash on proxy_pass matters: with this form, NGINX replaces the matching /site2/ prefix before sending the request, so the upstream receives a root-style path. Configure the upstream WordPress site to know that its public URL includes /site2, or use an upstream layout that preserves the prefix. If the application expects the prefix but the proxy strips it, links and redirects will be wrong; if both preserve it, the prefix can be duplicated.

Pass the original host and scheme so WordPress can generate HTTPS canonical URLs and correct cookies. Configure the upstream or its trusted-proxy settings to honor those forwarded values. After enabling the proxy, inspect redirects, login cookies, generated CSS and JavaScript URLs, media links and cache keys. A proxy that works for the home page can still fail on authentication or uploads.

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

Apply the change safely

  1. Choose the model. Decide between a Multisite subsite, a standalone /site2/ installation or a separate upstream. Write down the public URL and the desired isolation boundary.
  2. Prepare the application. Create the second directory and database, or provision the upstream service. Configure WordPress’s public scheme, host and path before importing content.
  3. Edit the single server block. Keep both routes under the same server_name. Add the specific second-site location and the correct root-site fallback; remove or adjust conflicting duplicate blocks.
  4. Protect PHP execution. Retain try_files $uri =404 in the PHP location and verify that the FastCGI socket exists. Do not send every request to one installation’s index.php.
  5. Validate configuration. Run nginx -t. Fix every syntax, include-file and permission error before reloading.
  6. Reload NGINX. Use your operating system’s service manager to reload NGINX without dropping existing connections. If the reload fails, restore the last known-good configuration and inspect the error log.
  7. Test privately first. Use a staging hostname, an allowlisted network or maintenance mode while checking both applications. Do not rely on a successful configuration test as proof that WordPress URLs work.

Verification checklist after the reload

  • Open the root site’s home page and a nested pretty permalink.
  • Open /site2/ and a nested permalink from the second site.
  • Open /site2/wp-admin/, log in, log out and confirm that every redirect remains on the intended host and path.
  • Load CSS, JavaScript, images and fonts from both sites. A second-site asset must not fall through to the root site’s directory or cache.
  • Upload media from each dashboard and open the resulting files in a private browser window.
  • Check that canonical redirects always use HTTPS and do not add, remove or duplicate /site2.
  • For Multisite, create or access another subsite and confirm the expected wp-content/uploads/sites/ location.
  • For a reverse proxy, inspect the upstream’s received Host, X-Forwarded-Proto, cookies, redirects and cache behavior.
  • Review NGINX access and error logs plus PHP-FPM logs while performing these tests. Logs usually identify whether a failure is routing, permissions, PHP execution or application configuration.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Troubleshoot the failures that occur most often

Every second-site URL returns the first site’s page

The root fallback is catching the request. Confirm that the /site2/ prefix exists in the active server block, that its fallback is exactly /site2/index.php?$args, and that another server block is not serving the same host. Reload only after nginx -t succeeds, then retest with a cache-bypassing request.

/site2/ works but pretty permalinks return 404

Check the second site’s try_files rule and make sure the fallback includes the original query string. Confirm that the request reaches the intended PHP-FPM process and that WordPress permalinks have been saved after the public URL was corrected.

Rank #4
Sale
UGREEN USB to USB C Adapter Combo 4-Pack, 10Gbps USB C Converter Space Gray | Data transfer & Fast charging for MacBook, iPhone 17/16/15, iPad, Samsung Galaxy, Apple Watch
  • Dual Converters, Infinite Potential:Includes 2× USB C male to USB A female adapters and 2× USB A male to USB C female adapters. Perfect for a wide range of uses—tablets with Bluetooth keyboards, expand USB ports on macbook, and more. Two different converters for all your daily needs
  • Next-Level 10Gbps & 3A Charging: No more slow 480Mbps, this usb to usb c adapter has a transfer speed of up to 10Gbps, allowing you to do more transferring in less time. This usb adapter fits both USB A and USB C charger, supporting up to 3A fast charging
  • Upgraded Exquisite Craftsmanship: With an aluminum alloy housing and metal connector, the usbc to usb adapter is extremely durable and sturdy. Rigorously tested to withstand more than 10,000 times of plugging and unplugging, ensuring long-lasting performance
  • Broad Compatible: The usb c to usb adapter widely supports all USB C/ USB A devices like laptops, tablets, cellphones, car chargers, and phone chargers. Such as compatible with MacBook Pro/Air 2023/2022, Thunderbolt 4/3 Devices,Apple MagSafe Watch 9/8/7/SE/Ultra, iPad Pro 2022/2021, Samsung Galaxy S23/S20/S10, and iPhone 17/16/15 Pro. Plug and play
  • Please Note: To reach 10Gbps speed, keep the cable under 3.3 ft. For USB A Male to USB C adapters, try flipping the USB C connector. USB C Male to USB A adapters support bidirectional 10Gbps transfer within 3.3 ft

PHP downloads, displays source, or returns 502

A download or source display means the request did not reach a PHP handler; a 502 generally means NGINX cannot connect to PHP-FPM. Verify that the PHP regular-expression location is active, try_files $uri =404 resolves the script, the socket path matches the installed PHP version, and PHP-FPM is running. Check permissions on the socket and the script path shown in the error log.

Redirect loops or a login that immediately logs out

Make the WordPress scheme and host agree with the public URL. In a proxy deployment, pass Host and X-Forwarded-Proto and configure WordPress or its trusted-proxy handling to recognize HTTPS. Delete stale cookies for the host, then test in a private window. A mismatch between example.com/site2 and a root-level cookie or redirect commonly exposes an incorrect path setting.

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

Images or scripts from the second site come from site one

Inspect the generated URL and the NGINX access log. Confirm that the second installation’s Site Address includes /site2, that the dedicated prefix location is active, and that cache rules vary by path. Never let a broad static-file or cache rule rewrite /site2/wp-content/ to the root site’s directory.

Multisite administration or uploads fail while the home page works

The standalone routing pattern is incomplete for a path-based network. Reapply the official Multisite subdirectory NGINX rules, including the documented handling for administrative and WordPress paths, then verify network upload directories and roles. Test a newly created subsite rather than assuming the main site’s home page represents the whole network.

Best Value
Sale
Anker USB C Hub, 5-in-1 USBC to HDMI Splitter with 4K Display | 85W Max PD, 1 Powered USB-C 5Gbps & 2 Powered USB-A 3.0 5Gbps Data Ports, for MacBook Pro, MacBook Air, Dell and More (Black)
  • 5-in-1 Connectivity: Equipped with a 4K HDMI port, a 5 Gbps USB-C data port, two 5 Gbps USB-A ports, and a USB C 100W PD-IN port. Note: The USB C 100W PD-IN port supports only charging and does not support data transfer devices such as headphones or speakers.
  • Powerful Pass-Through Charging: Supports up to 85W pass-through charging so you can power up your laptop while you use the hub. Note: Pass-through charging requires a charger (not included). Note: To achieve full power for iPad, we recommend using a 45W wall charger.
  • Transfer Files in Seconds: Move files to and from your laptop at speeds of up to 5 Gbps via the USB-C and USB-A data ports. Note: The USB C 5Gbps Data port does not support video output.
  • HD Display: Connect to the HDMI port to stream or mirror content to an external monitor in resolutions of up to 4K@30Hz. Note: The USB-C ports do not support video output.
  • What You Get: Anker 332 USB-C Hub (5-in-1), welcome guide, our worry-free 18-month warranty, and friendly customer service.

Backups, updates and operational boundaries

With standalone sites, schedule independent database and file backups and document which NGINX paths, PHP versions and credentials belong to each installation. You can restore one site without restoring the other, but a shared host remains a common failure and security boundary. Patch NGINX, PHP-FPM and both WordPress installations even when only one site appears active.

With Multisite, back up the network database, shared core, plugins, themes and uploads as a unit. Test restoration of a subsite and of the whole network. Network activation, shared plugins and core updates can affect every site, so stage changes and verify plugin compatibility first.

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

In a reverse-proxy design, back up the proxy configuration as well as each upstream. Record the path-rewrite behavior, forwarded-header trust settings and cache rules; losing that information can make an otherwise valid WordPress backup appear broken when it is brought back online.

Can a path-based site later use its own domain?

Yes. WordPress documentation describes domain mapping in which a subdirectory site such as networkdomain.com/subsite1 is also presented at another top-level domain. This is primarily a Multisite use case: start with path-based addresses, then map a subsite to its own domain when branding or migration requirements change. You still need DNS, TLS, canonical URL settings and NGINX routing for the mapped host, and you should retest cookies, redirects and media URLs after the change.

The practical decision

For two sites that share an organization, administration and release policy, use Multisite and its documented NGINX subdirectory rules. For two sites that must remain independently updateable and restorable, use separate WordPress directories and databases under one server block. For stronger runtime separation, keep the same public path model but proxy the second site to its own server or container. In every design, the decisive rule is the same: each public path must fall back to the correct WordPress front controller, and NGINX—not WordPress—must enforce that routing.

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.

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

Leave a Reply

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

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.

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
Crashes, No Sound, or Screen Glitches?Free driver scan
PC Slower Than It Used to Be?Free scan - under a minute

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.