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

iTechGuides is reader-supported. When you buy through links on our site, we may earn an affiliate commission. As an Amazon Associate I earn from qualifying purchases. Learn more

Yes—you can run two WordPress sites on one domain with NGINX. Put the first site at the domain root (for example, https://example.com/) and route the second to a path such as https://example.com/site2/. Use one NGINX server block, a dedicated try_files fallback for each site, and a PHP handler that rejects nonexistent scripts. Choose WordPress Multisite when both sites should share one network, core files and administration layer; choose two standalone installations when code, databases, plugins, updates and backups must remain independent. If the applications run on different machines, proxy each path to its own upstream instead of using one local document root.

Choose the architecture before changing NGINX

The URL shape is similar in every design, but the operational consequences are not. Decide whether the second site is a subsite in one WordPress network, a completely separate WordPress installation, or an application on another server.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Design Public URL Administration and storage Best fit Main trade-off
WordPress Multisite, subdirectory network example.com/site2/ One network dashboard and shared WordPress core; sites use network tables and settings One team managing related sites with common governance A network-wide change, incompatible plugin or failed update can affect multiple sites
Two standalone installations example.com/ and example.com/site2/ Separate files, databases, wp-config.php files, plugins, themes and update schedules Strong isolation or independently restorable sites Two dashboards, two maintenance routines and separate resource use
Separate upstream applications One path per backend, such as example.com/site2/ Each VM, container or internal web server owns its WordPress stack; NGINX is the reverse proxy Existing services that cannot share a filesystem or PHP-FPM pool Proxy headers, canonical URLs, cookies and cache behavior require extra testing

When Multisite is the right choice

A path-based Multisite network can address sites as example.com/subsite. It gives a network administrator one place to manage users, updates and shared policy. WordPress’s preparation guidance identifies this as a path-based network and notes that NGINX needs more involved Multisite rules than a single-site install. Confirm that every required plugin supports Multisite, decide which users can administer individual sites, and verify that your backup system can restore one site as well as the whole network before converting an existing single site.

When standalone installs are safer

Use two independent installations when the sites have different owners, release schedules, plugin sets or recovery requirements. The first installation can remain at /var/www/example.com; place the second at /var/www/example.com/site2 and give it a separate database and credentials. A fatal plugin error, database restore or update on one site then has a much smaller blast radius. You still share the domain, TLS certificate and NGINX process, so an NGINX configuration error can affect both.

#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.

When to reverse proxy

Use a reverse proxy when the second WordPress application runs in another VM, container or internal web server. NGINX receives /site2/, sends it to a configured upstream and returns the response. The backend must know the public host, scheme and path; otherwise it may redirect to an internal hostname, generate incorrect asset URLs or set cookies for the wrong path.

Prerequisites and URL decisions

  • Administrative access to the NGINX server. WordPress cannot write NGINX rules for you.
  • A DNS record and TLS certificate covering the domain.
  • One NGINX server block for that host.
  • For local applications, a supported PHP-FPM service and a database for each standalone site. The PHP-FPM socket in examples is illustrative; your distribution may use another path or PHP version.
  • Write access for the web worker to the intended WordPress directories, with ownership and permissions that do not make the entire server writable by the application.
  • A path that will not collide with existing pages, media or API endpoints. In the examples, the second site is /site2/.

Decide whether the public path includes a trailing slash. WordPress normally canonicalizes directory-like URLs to /site2/. Add an explicit redirect from /site2 so that links, cookies and caches converge on one spelling.

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

Install a second standalone WordPress site

  1. Create the directory. Make the document-root path, such as /var/www/example.com/site2, and place the second WordPress files there. Do not copy a live site’s wp-config.php or database credentials unless you deliberately want both installations to share them.
  2. Create a separate database and database user. A separate schema and credentials make exports, restores and permission reviews independent. Use a distinct table prefix as an additional safeguard against accidental cross-site operations.
  3. Run the WordPress installer. Open the second site’s public path after NGINX routing is in place, or complete the installation from the command line. Create an administrator account that is separate from the first site’s account unless the same person is intentionally responsible for both.
  4. Set both URL fields consistently. For a site served at https://example.com/site2, WordPress Address (URL) and Site Address (URL) should both use the public HTTPS scheme and include /site2. A mismatch—such as one value pointing to https://example.com—causes login loops, redirects to the root site or broken asset URLs.
  5. Check filesystem ownership. The PHP-FPM worker must be able to read PHP files and write only the directories that need it, such as uploads. Avoid broad recursive write permissions as a shortcut.
  6. Keep the installations logically separate. Use separate update windows, plugin inventories and backup jobs. Document which database and directory belong to each URL before making changes.

Configure one NGINX server block for two local installations

The essential rule is that each path has its own front-controller fallback. Existing files and directories are served directly; a pretty permalink that does not exist on disk is sent to that site’s index.php. The PHP location then validates the script before passing it to FastCGI.

Rank #2
Sale
Anker USB-C Hub, 5-in-1 USB Hub for Laptops, 4K HDMI Multiport Adapter
  • 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 443 ssl;
    server_name example.com;
    root /var/www/example.com;

    # Redirect the path without its trailing slash.
    location = /site2 {
        return 301 /site2/;
    }

    # Second standalone WordPress installation.
    location /site2/ {
        try_files $uri $uri/ /site2/index.php?$args;
    }

    # Root WordPress installation.
    location / {
        try_files $uri $uri/ /index.php?$args;
    }

    # Validate every requested PHP script before FastCGI.
    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;
    }
}

The document root makes /site2/wp-content/... resolve to the second installation’s directory, while /wp-content/... resolves to the first. The location /site2/ prefix is more specific than location /, so requests under that path receive the second site’s fallback. The regular-expression PHP location handles /index.php and /site2/index.php; try_files $uri =404 prevents NGINX from handing a nonexistent filename to PHP-FPM.

Replace the example socket with the socket exposed by your PHP-FPM installation. The path /var/run/php/php8.3-fpm.sock is only an example. If your host uses a TCP listener, use its configured address instead. Keep SSL directives, logging and any existing security headers in the same server block; they are omitted above to keep the routing relationship visible.

Why the fallback must include the path

The root site falls back to /index.php?$args, but the second site must fall back to /site2/index.php?$args. Sending a request such as /site2/about/team/ to the root index would make the first WordPress installation interpret the request. The result is usually a 404 from the wrong site, a redirect to the root site’s home page or a page that appears to ignore the second installation entirely.

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

Do not rely on .htaccess

As the WordPress.org Developer Documentation NGINX guide states: "With Nginx there is no directory-level configuration file like Apache’s .htaccess or IIS’s web.config files." Permalink rewrites, PHP routing, redirects, cache rules and restrictions therefore belong in NGINX’s server-level configuration, managed by the server administrator. Installing a plugin that expects to edit .htaccess does not change this limitation.

Use WordPress Multisite instead of two standalone sites

Multisite changes the application model, not merely the NGINX path. First enable the network feature in WordPress, choose a subdirectory network, and complete the network’s generated configuration changes. Then create the second site from the Network Admin dashboard and choose a path such as site2.

A simple single-site try_files rule is not a complete Multisite configuration. The official NGINX pattern includes handling for the network’s /wp-admin, /wp-* resources and PHP paths so that subsites resolve through the main WordPress front controller. Apply the Multisite-specific rules supplied for your WordPress version rather than copying the standalone block unchanged. Test network administration, subsite administration, media and login flows before switching traffic.

Rank #4
Sale
UGREEN USB to USB C Adapter Combo 4-Pack, 10Gbps USB C Converter Space Gray
  • 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

Operational differences to check

  • Plugins and themes: a network administrator may force activation or updates across sites. A plugin that works on a standalone install may not support network activation.
  • Users and roles: users can belong to several sites with different roles. Review who can access Network Admin versus an individual site’s dashboard.
  • Uploads: Multisite commonly stores subsite media under a path such as wp-content/uploads/sites/. Verify that your backup and CDN rules include that location.
  • Failure scope: shared core files and network tables make one update or database problem potentially network-wide.
  • Domain flexibility: a subdirectory site can later be presented at another top-level domain through domain mapping, provided DNS, TLS and the mapping configuration are correct.

Proxy the second site to another application server

If the second WordPress stack is not on the same filesystem, replace its local try_files location with a proxy location. Define an upstream for the backend and pass the original host and request scheme.

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.
upstream wordpress_site2 {
    server 10.0.0.22:8080;
}

server {
    listen 443 ssl;
    server_name example.com;

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

    location /site2/ {
        proxy_pass http://wordpress_site2/;
        proxy_set_header Host $host;
        proxy_set_header X-Forwarded-Host $host;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
    }
}

In this example, the trailing slash on proxy_pass causes NGINX to replace the matching /site2/ prefix before sending the request, so the upstream receives a root-style URL. If the backend itself is configured to serve WordPress under /site2/, use the corresponding proxy form and configure its public URL accordingly; do not strip the prefix accidentally.

Configure the upstream WordPress Address and Site Address for the externally visible scheme and path. If it is behind HTTPS termination, the application must trust the forwarded HTTPS indication in a controlled way. Check canonical redirects, generated CSS and JavaScript URLs, login cookies, media URLs and cache keys. A proxy that forwards only Host but not the original scheme commonly creates HTTP redirects from an HTTPS site.

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.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Apply, validate and reload the configuration

  1. Save a rollback copy. Keep the previous NGINX configuration and record the current WordPress database and file backup before changing routing.
  2. Validate syntax. Run nginx -t with the same privileges and configuration file used by the service. Fix every reported error before reloading.
  3. Reload, do not restart unnecessarily. Use your service manager’s reload operation, such as systemctl reload nginx, so existing connections are not dropped by a full stop/start.
  4. Watch logs while testing. Inspect the NGINX access and error logs and the PHP-FPM log. A 404 from the wrong document root, a permission error or an upstream timeout usually becomes obvious there.
  5. Test over HTTPS. Browsers may cache redirects, so use a private window or clear cached redirects while verifying a new path.

Verification checklist for both sites

  • Open each home page and confirm the branding, title and canonical host are correct.
  • Visit at least one nested pretty permalink on each site, not just the home page.
  • Open /site2/wp-admin/, log in, log out and confirm that the session remains on the second path.
  • Load CSS, JavaScript, favicon and image assets. Confirm that a /site2/ asset never falls through to the root installation.
  • Upload media from the second dashboard and open the resulting attachment URL.
  • Check redirects from both slash and non-slash forms, HTTP to HTTPS, and any configured www variant.
  • For Multisite, create or access another subsite and verify that its media uses the expected wp-content/uploads/sites/ structure.
  • For a reverse proxy, inspect the received Host, X-Forwarded-Proto and X-Forwarded-For values, along with cookies and cache headers.
  • Request a nonexistent PHP filename and confirm it returns a safe 404 instead of being executed or passed upstream.

Troubleshoot the common failure modes

Symptom Likely cause Correction
/site2/ displays the first site’s page The generic root fallback wins, or the second location falls back to /index.php Keep a dedicated location /site2/ and use /site2/index.php?$args as its fallback. Validate that the request is reaching the intended server block.
Pretty links work on the home page but return 404 No front-controller fallback, or the fallback points at the wrong installation Use try_files $uri $uri/ /site2/index.php?$args; for the second path and reload NGINX after testing.
PHP files download or produce a 404 PHP-FPM is not selected, the socket is wrong, or the PHP location cannot find the script Check the PHP-FPM service and socket, confirm fastcgi_param SCRIPT_FILENAME, and inspect NGINX and PHP-FPM logs.
Login loops or redirects to the root domain WordPress Address and Site Address omit /site2, use HTTP, or disagree with the proxy’s public scheme Set both URL values to the exact public HTTPS path and configure forwarded-scheme handling on a proxy.
CSS and images are missing Incorrect URL settings, filesystem ownership, or requests being routed to site one Inspect the browser’s requested URLs, verify files under the second document directory, and test /site2/wp-content/ directly.
Only the proxy version fails The upstream expects a different path, or required headers and cookies are absent Review the trailing slash behavior of proxy_pass, pass host and forwarded headers, and check upstream access logs.
Multisite administration is broken Standalone rewrite rules were used instead of the Multisite NGINX pattern Apply the Multisite-specific rules for /wp-admin, /wp-* and PHP requests, then retest network and subsite dashboards.

Backups, updates and security boundaries

Two URLs do not automatically mean two security boundaries. Both sites still depend on the same NGINX process, TLS configuration and host operating system. Keep NGINX, PHP and the operating system patched, restrict database users to their own databases, and avoid granting the web worker write access to executable code unless an update process requires it.

For standalone sites, back up each database and filesystem independently and perform a test restore. For Multisite, retain a network-wide backup and document how to restore one site’s uploads and tables without overwriting its neighbors. Before a network-wide plugin or core update, take a fresh backup because the shared runtime increases the potential failure scope.

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

Place administrative endpoints behind the protections appropriate for your environment, such as strong authentication, limited administrator accounts and rate controls. Do not attempt to solve NGINX routing with a WordPress plugin that assumes Apache’s .htaccess; server-level access is required for the rules described here.

Which design should you select?

  • Choose Multisite if one organization wants one network dashboard, shared core management and path-based subsites, and it has verified plugin, role and backup compatibility.
  • Choose two standalone installs if independent databases, plugins, update schedules and restores matter more than centralized administration.
  • Choose reverse proxying if the applications already live on separate servers or containers and you can configure their public URL and forwarded-header trust correctly.

Whichever option you choose, the NGINX principle is the same: route the most specific path to the correct application, give that application its own front-controller fallback, validate PHP scripts before FastCGI, and verify every login, permalink, asset and redirect from the public URL.

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.