Map Hostname in etc hosts File | Generated by AI

Home 2026.03

Question: How to add a record in /etc/hosts so I can easily access http://192.168.1.36:3001/dashboard?

Answer:

You can map a custom hostname (like myapp.local) to your IP (192.168.1.36) using the /etc/hosts file. This lets you access your service using a friendly name instead of the raw IP.

Step-by-step

1. Open /etc/hosts with root privileges

sudo nano /etc/hosts

(or use vim if you prefer)

2. Add a new entry at the bottom

192.168.1.36   myapp.local

3. Save and exit

4. Access your app

Now you can open:

http://myapp.local:3001/dashboard

Notes

192.168.1.36   myapp.local dashboard.local api.local
sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder

Optional (Cleaner URLs)

If you want to access without port/path, like:

http://myapp.local

You’ll need a reverse proxy (e.g., Nginx):

Example:

server {
    listen 80;
    server_name myapp.local;

    location / {
        proxy_pass http://192.168.1.36:3001/dashboard;
    }
}

If you want, I can help you set up Nginx or a local dev DNS setup (like dnsmasq) for a more scalable solution.


Back Donate