Sites use .localhost by default because it works everywhere with no setup. If you prefer .test (like Laravel Valet and Herd), LaraMonster can point *.test at your computer too.
.localhost: nothing to set up
Browsers, curl and most tools resolve any name ending in .localhost to your own computer, as the internet standard requires. That's why http://blog.localhost:8080 works the moment the folder exists, on every system, offline, without touching system files.
.localhost. If your app calls another local site by name (for example an API at api.localhost), use .test with DNS set up, or call 127.0.0.1 with a Host header.Switching to .test
- Change the TLD
In SettingsDomains (DNS) pick
test, or runlaramonster tld test. Every site's address changes at once. - Set up DNS
Click Configure DNS (asks for your password once), or run
laramonster dns setup. - Check it
Settings shows Working, and
laramonster dns statussays the names resolve.
$ laramonster tld test
$ laramonster dns setup
$ laramonster dns status
$ ping -c1 blog.test # answers from 127.0.0.1Remember to update APP_URL in your projects' .env files to the new addresses.
How it works on each system
LaraMonster runs a tiny DNS server on 127.0.0.1:5354 that answers every *.test name with your own computer. dns setup tells your system to ask it, using the best method available:
| System | Method | What it changes |
|---|---|---|
| macOS | Resolver file | Creates /etc/resolver/test. Only .test lookups go to LaraMonster. |
| Linux with systemd-resolved | resolved drop-in | Creates /etc/systemd/resolved.conf.d/laramonster.conf with Domains=~test. |
| Windows, other Linux | hosts file | Keeps one line per site in a block LaraMonster manages in your hosts file. Click Sync hosts file after adding sites. |
Undoing it
$ laramonster dns remove
$ laramonster tld localhostdns remove deletes the resolver file, the systemd-resolved drop-in or LaraMonster's block in the hosts file, depending on the method used.