How to add subdomain for wp multisite?

I managed to install (migrate an existing) wp multisite on Local.
WP multisite is using subdomains.

I simply do not know how to add the subdomain that I need.
Current installation finds only the main domain.

Questions:

  1. Where do I find the hosts file to modify?
  2. Main domain is “ben.local” how do I add “eng.ben.local”?

I am using ngynx, d

System Details

  • Local version 5.9.7+5156

  • Windows 10 Professional_

  • Attach the Local Log.

{"thread":"main","class":"Process","process":"mysql","level":"warn","message":"2021-01-12T18:30:55.321924Z 0 [System] [MY-010116] [Server] %%resourcesPath%%\\lightning-services\\mysql-8.0.16+5\\bin\\win64\\bin\\mysqld.exe (mysqld 8.0.16) starting as process 15652","timestamp":"2021-01-12T18:30:57.499Z"}
{"thread":"main","class":"Process","process":"mysql","level":"warn","message":"2021-01-12T18:30:55.323884Z 0 [Warning] [MY-013243] [Server] --character-set-server: The character set UTF8MB3 is deprecated and will be removed in a future release. Please consider using UTF8MB4 instead.","timestamp":"2021-01-12T18:30:57.500Z"}
{"thread":"main","class":"Process","process":"mysql","level":"warn","message":"2021-01-12T18:30:57.465650Z 0 [Warning] [MY-010068] [Server] CA certificate ca.pem is self signed.","timestamp":"2021-01-12T18:30:57.500Z"}
{"thread":"main","class":"Process","process":"mysql","level":"warn","message":"2021-01-12T18:30:57.499919Z 0 [System] [MY-010931] [Server] %%resourcesPath%%\\lightning-services\\mysql-8.0.16+5\\bin\\win64\\bin\\mysqld.exe: ready for connections. Version: '8.0.16'  socket: ''  port: 10035  MySQL Community Server - GPL.","timestamp":"2021-01-12T18:30:57.501Z"}
{"thread":"main","service":{},"serviceBinVersion":{},"message":"Creating MySQL database...","level":"info","timestamp":"2021-01-12T18:30:57.838Z"}
{"thread":"main","class":"HostsFileService","stdout":"Updating hosts file at  C:\\WINDOWS\\System32\\drivers\\etc\\hosts\nUpdated hosts file at  C:\\WINDOWS\\System32\\drivers\\etc\\hosts\n","stderr":"","level":"info","message":"Updated hosts.","timestamp":"2021-01-12T18:30:58.381Z"}
{"thread":"main","class":"WordPressInstaller","message":"Init WordPressInstaller","level":"info","timestamp":"2021-01-12T18:30:58.388Z"}
{"thread":"main","class":"WordPressInstaller","message":"Starting standardInstall()","level":"info","timestamp":"2021-01-12T18:30:58.389Z"}
{"thread":"main","class":"WordPressInstaller","message":"maybeGetLatestVersion()","level":"info","timestamp":"2021-01-12T18:30:58.389Z"}
{"thread":"main","class":"WordPressInstaller","latestOfflineWpVersion":"5.6","level":"info","message":"Latest offline version info","timestamp":"2021-01-12T18:30:58.390Z"}
{"thread":"main","class":"WordPressInstaller","version":"5.6","download":"https://downloads.wordpress.org/release/wordpress-5.6.tar.gz","level":"info","message":"Latest version info","timestamp":"2021-01-12T18:30:58.984Z"}
{"thread":"main","class":"WordPressInstaller","message":"Configuring wp-config.php","level":"info","timestamp":"2021-01-12T18:31:50.330Z"}
{"thread":"main","class":"WordPressInstaller","message":"Installing WordPress","level":"info","timestamp":"2021-01-12T18:31:50.673Z"}
{"thread":"main","class":"WordPressInstaller","message":"Attempting to delete Akismet and Hello Dolly","level":"info","timestamp":"2021-01-12T18:31:52.535Z"}
{"thread":"main","class":"WordPressInstaller","message":"Writing salts to wp-config.php","level":"info","timestamp":"2021-01-12T18:31:54.031Z"}
{"thread":"main","reason":{},"p":{},"level":"warn","message":"Unhandled Rejection.","timestamp":"2021-01-13T02:08:04.871Z"}
{"thread":"main","class":"Process","process":"mailhog","pid":21560,"level":"info","message":"Killing process","timestamp":"2021-01-13T02:08:05.016Z"}
{"thread":"main","class":"Process","process":"phpCgi","pid":6684,"level":"info","message":"Killing process","timestamp":"2021-01-13T02:08:05.030Z"}
{"thread":"main","class":"Process","process":"phpCgi","pid":6836,"level":"info","message":"Killing process","timestamp":"2021-01-13T02:08:05.043Z"}
{"thread":"main","class":"Process","process":"nginx","pid":16584,"level":"info","message":"Killing process","timestamp":"2021-01-13T02:08:05.058Z"}
{"thread":"main","class":"Process","process":"mysql","pid":4616,"level":"info","message":"Killing process","timestamp":"2021-01-13T02:08:05.071Z"}
{"thread":"main","class":"Process","process":"php-adminer","pid":16936,"level":"info","message":"Killing process","timestamp":"2021-01-13T02:08:05.085Z"}
{"thread":"main","class":"SiteProvisionerService","message":"Creating site folders...","level":"info","timestamp":"2021-01-13T02:08:48.083Z"}
{"thread":"main","class":"SiteProvisionerService","message":"Copying service config templates...","level":"info","timestamp":"2021-01-13T02:08:48.086Z"}
{"thread":"main","class":"ConfigTemplatesService","message":"Compiling service configs...","level":"info","timestamp":"2021-01-13T02:08:48.221Z"}
{"thread":"main","service":{},"serviceBinVersion":{},"dataPath":"C:/Users/Lenovo/AppData/Roaming/Local/run/rFXm4bpWE/mysql/data","level":"info","message":"Initializing MySQL datadir...","timestamp":"2021-01-13T02:08:48.394Z"}
{"thread":"main","class":"ConfigTemplatesService","message":"Compiling service configs...","level":"info","timestamp":"2021-01-13T02:08:55.752Z"}
{"thread":"main","class":"Process","process":"nginx","pid":20128,"level":"info","message":"Killing process","timestamp":"2021-01-13T02:08:56.176Z"}
{"thread":"main","service":{},"serviceBinVersion":{},"message":"Setting up MySQL user...","level":"info","timestamp":"2021-01-13T02:08:56.623Z"}
{"thread":"main","class":"HostsFileService","level":"info","message":"Updating hosts with","timestamp":"2021-01-13T02:08:56.717Z"}
{"thread":"main","class":"Process","process":"mysql","level":"warn","message":"2021-01-13T02:08:55.982723Z 0 [System] [MY-010116] [Server] %%resourcesPath%%\\lightning-services\\mysql-8.0.16+5\\bin\\win64\\bin\\mysqld.exe (mysqld 8.0.16) starting as process 11076","timestamp":"2021-01-13T02:08:58.058Z"}
{"thread":"main","class":"Process","process":"mysql","level":"warn","message":"2021-01-13T02:08:55.984278Z 0 [Warning] [MY-013243] [Server] --character-set-server: The character set UTF8MB3 is deprecated and will be removed in a future release. Please consider using UTF8MB4 instead.","timestamp":"2021-01-13T02:08:58.058Z"}
{"thread":"main","class":"Process","process":"mysql","level":"warn","message":"2021-01-13T02:08:58.017218Z 0 [Warning] [MY-010068] [Server] CA certificate ca.pem is self signed.","timestamp":"2021-01-13T02:08:58.059Z"}
{"thread":"main","class":"Process","process":"mysql","level":"warn","message":"2021-01-13T02:08:58.058574Z 0 [System] [MY-010931] [Server] %%resourcesPath%%\\lightning-services\\mysql-8.0.16+5\\bin\\win64\\bin\\mysqld.exe: ready for connections. Version: '8.0.16'  socket: ''  port: 10041  MySQL Community Server - GPL.","timestamp":"2021-01-13T02:08:58.059Z"}
{"thread":"main","class":"HostsFileService","stdout":"Updating hosts file at  C:\\WINDOWS\\System32\\drivers\\etc\\hosts\nUpdated hosts file at  C:\\WINDOWS\\System32\\drivers\\etc\\hosts\n","stderr":"","level":"info","message":"Updated hosts.","timestamp":"2021-01-13T02:08:58.461Z"}
{"thread":"main","service":{},"serviceBinVersion":{},"message":"Creating MySQL database...","level":"info","timestamp":"2021-01-13T02:08:58.532Z"}
{"thread":"main","class":"WordPressInstaller","message":"Init WordPressInstaller","level":"info","timestamp":"2021-01-13T02:08:58.675Z"}
{"thread":"main","class":"WordPressInstaller","message":"Starting standardInstall()","level":"info","timestamp":"2021-01-13T02:08:58.675Z"}
{"thread":"main","class":"WordPressInstaller","message":"maybeGetLatestVersion()","level":"info","timestamp":"2021-01-13T02:08:58.676Z"}
{"thread":"main","class":"WordPressInstaller","latestOfflineWpVersion":"5.6","level":"info","message":"Latest offline version info","timestamp":"2021-01-13T02:08:58.676Z"}
{"thread":"main","class":"WordPressInstaller","version":"5.6","download":"https://downloads.wordpress.org/release/wordpress-5.6.tar.gz","level":"info","message":"Latest version info","timestamp":"2021-01-13T02:08:59.326Z"}
{"thread":"main","class":"WordPressInstaller","message":"Configuring wp-config.php","level":"info","timestamp":"2021-01-13T02:09:43.546Z"}
{"thread":"main","class":"WordPressInstaller","message":"Installing WordPress","level":"info","timestamp":"2021-01-13T02:09:44.167Z"}
{"thread":"main","class":"WordPressInstaller","message":"Attempting to delete Akismet and Hello Dolly","level":"info","timestamp":"2021-01-13T02:09:47.172Z"}
{"thread":"main","class":"WordPressInstaller","message":"Writing salts to wp-config.php","level":"info","timestamp":"2021-01-13T02:09:47.889Z"}
{"thread":"main","class":"Process","process":"nginx","pid":19448,"level":"info","message":"Killing process","timestamp":"2021-01-13T02:13:06.656Z"}
{"thread":"main","reason":{},"p":{},"level":"warn","message":"Unhandled Rejection.","timestamp":"2021-01-13T02:27:59.132Z"}
{"thread":"main","class":"Process","process":"mailhog","pid":3672,"level":"info","message":"Killing process","timestamp":"2021-01-13T02:28:01.228Z"}
{"thread":"main","class":"Process","process":"phpCgi","pid":10572,"level":"info","message":"Killing process","timestamp":"2021-01-13T02:28:01.243Z"}
{"thread":"main","class":"Process","process":"phpCgi","pid":6808,"level":"info","message":"Killing process","timestamp":"2021-01-13T02:28:01.257Z"}
{"thread":"main","class":"Process","process":"nginx","pid":16380,"level":"info","message":"Killing process","timestamp":"2021-01-13T02:28:01.271Z"}
{"thread":"main","class":"Process","process":"mysql","pid":17184,"level":"info","message":"Killing process","timestamp":"2021-01-13T02:28:01.283Z"}
{"thread":"main","class":"Process","process":"php-adminer","pid":19956,"level":"info","message":"Killing process","timestamp":"2021-01-13T02:28:01.296Z"}
{"thread":"main","class":"ConfigTemplatesService","message":"Compiling service configs...","level":"info","timestamp":"2021-01-13T02:28:03.033Z"}
{"thread":"main","class":"Process","process":"nginx","pid":14616,"level":"info","message":"Killing process","timestamp":"2021-01-13T02:28:03.411Z"}
{"thread":"main","class":"Process","process":"mysql","level":"warn","message":"2021-01-13T02:28:03.353704Z 0 [System] [MY-010116] [Server] %%resourcesPath%%\\lightning-services\\mysql-8.0.16+5\\bin\\win64\\bin\\mysqld.exe (mysqld 8.0.16) starting as process 18468","timestamp":"2021-01-13T02:28:05.218Z"}
{"thread":"main","class":"Process","process":"mysql","level":"warn","message":"2021-01-13T02:28:03.355797Z 0 [Warning] [MY-013243] [Server] --character-set-server: The character set UTF8MB3 is deprecated and will be removed in a future release. Please consider using UTF8MB4 instead.","timestamp":"2021-01-13T02:28:05.218Z"}
{"thread":"main","class":"Process","process":"mysql","level":"warn","message":"2021-01-13T02:28:04.282798Z 0 [System] [MY-010229] [Server] Starting crash recovery...","timestamp":"2021-01-13T02:28:05.218Z"}
{"thread":"main","class":"Process","process":"mysql","level":"warn","message":"2021-01-13T02:28:04.288274Z 0 [System] [MY-010232] [Server] Crash recovery finished.","timestamp":"2021-01-13T02:28:05.218Z"}
{"thread":"main","class":"Process","process":"mysql","level":"warn","message":"2021-01-13T02:28:05.192321Z 0 [Warning] [MY-010068] [Server] CA certificate ca.pem is self signed.","timestamp":"2021-01-13T02:28:05.219Z"}
{"thread":"main","class":"Process","process":"mysql","level":"warn","message":"2021-01-13T02:28:05.218721Z 0 [System] [MY-010931] [Server] %%resourcesPath%%\\lightning-services\\mysql-8.0.16+5\\bin\\win64\\bin\\mysqld.exe: ready for connections. Version: '8.0.16'  socket: ''  port: 10041  MySQL Community Server - GPL.","timestamp":"2021-01-13T02:28:05.219Z"}
{"thread":"main","class":"Process","process":"nginx","pid":20024,"level":"info","message":"Killing process","timestamp":"2021-01-13T03:30:43.486Z"}

When a multisite is created in Local, there should be an option to “Sync Multi-site Domains to Hosts File”

Do you see a link like the one pictured above?

TRUE! Found it. Mighrated multisite successfully
BUT only main domain shows
Since I use subdomains in this WPMU
and I do not know How to add subdomains for this WPMU.
Can you help?
Much appreciated!

Are each of the domains separate domains and not subdomains of the WP network?

Local supports something like this:

mainsite.local
site1.mainsite.local --> mainsite.local
site2.mainsite.local --> mainsite.local

The “Sync Multi-site domains to hosts file” button basically writes those subdomains to the hosts file.

At this time, Local doesn’t have the ability to manage secondary or “add-on” domains like:

mainsite.local
secondsite.local --> mainsite.local
thirdsite.local  --> mainsite.local

You “might” be able to manually do this, but I’ve never tried it, so if you get it working, let the community know!

The general flow would be:

  1. Edit your hosts file to account for secondary domains
  2. Edit the nginx configuration for Local’s router so that the domains can be resolved to the correct WP site

Here’s a screenshot to help point the way:

Good luck!

Thanks for clarifying the usage of Sync Multi-site domains to hosts file
I activated it and it works great!

Thanks for your help!

Maybe this is obvious, but one other thing I thought of and wanted to clarify – you’ll need to click that button if you add any new subsites as you’re working along.

Since WordPress will “know” about those subdomains, but your computer won’t – clicking that button will update the hosts file so that you can access the sites from the browser.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.