Search code examples
localhostip-addressdomain-name

How to use local domain name instead local ip address in Mac?


I want to access to my local web-server in mac with domain name instead ip address at other devices.

For example, 'custom.domain:8080' instead '192.168.xx.xx:8080'

What is the most simple way to achieve it?

Thanks.


Solution

  • Edit the file /etc/hosts, and add the following line:

    192.168.xx.xx custom.domain
    

    Then visit http://custom.domain:8080