Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

Is it possible to have more than one ".local" address per machine using Bonjour on OSX? I would like to add x.local and archive.x.local so that I can run multiple apache vhosts.

System Preferences > Sharing > Computer Name only allows me to have one currently.

share|improve this question
add comment

1 Answer

There is no GUI in OS X to have more than one .local hostname for a machine.

However, you can register programmatically any number of name and service combinations in the mDNS .local domain.

If you're looking to do this from a script (or on a temporary basis, manually), there is a command-line utility dns-sd, which you can use to register services. ( man dns-sd for the man page).

To register a web server, you'll want to use something like: dns-sd -R _http._tcp local so: dns-sd -R myserver _http._tcp local 8080

The service will remain registered as long as the command is active, so you will need to run it in the background to keep it running (add the & to the end to background the task).

The documentation explicitly states it can only register in the .local domain, so you likely won't be able to do archive.x.local, but you should be able to do archive-x.local.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.