Setup WordPress Multisite with xip.io or nip.io
-
xip.io and nip.io allow you to have a subdomain multisite WordPress site without needing to add a DNS entry to your hosts file for every subsite.
Here's how:- Create a new WordPress site using Laragon's Quick App. Let's say your new site's name is "mysite.test"
- Install WP CLI
- Open Laragon's Terminal and run
wp search-replace "mysite.test" "mysite.127.0.0.1.nip.io" --all-tables
(or you could set it toxip.io
, I haven't seen any difference). - Rename
laragon/etc/nginx/sites-enabled/auto.mysite.test.conf
tomysite.test.conf
, and change server name line toserver_name mysite.127.0.0.1.nip.io *.mysite.127.0.0.1.nip.io;
(or if you're using Apache, change theServerName
to bemysite.127.0.0.1.nip.io
andServerAlias
to be*.mysite.127.0.0.1.nip.io
). - In Laragon, click "Stop All" and then "Start All". Visit mysite.127.0.0.1.nip.io. It should be your site.
- Enable WordPress multisite, choosing the "sub-domain" option.
Now you can create any subdomain you want on your site, without ever needing to touch your hosts file again. Enjoy!
-
@mnelson4 : The 127.0.0.1 is still point to localhost. Do you know that Laragon supports xip.io (nip.io) in Menu > Tools > Wildcard DNS?
-
@leokhoa yeah I saw that, and that got me started down this path, but I'm not sure what enabling xip.io or nip.io in Laragon actually does. The link "How to manage 'Wildcard DNS'" points to https://forum.laragon.org/topic/1014 which doesn't appear to have been created yet.
So it sounds like there's something I don't understand about xip.io/nip.io yet, because I thought I was using it in my example above!