4

I am using lighttpd as my webserver.

Currently I am accessing it using the IP address as :

http://192.168.0.1

I want to access it as

http://myhostname.com

I would be using it in the local network only, and not the internet.

I don't know how to do this. I googled, but don't know the exact keywords to use.

oers
  • 18,436
  • 13
  • 66
  • 75
Mahendra Liya
  • 12,912
  • 14
  • 88
  • 114

3 Answers3

7

Put the following line to the file /etc/hosts:

192.168.0.1              myhostname.com

For instance, using the following command:

$ sudo echo -e '192.168.0.1\tmyhostname.com' >> /etc/hosts
YasirA
  • 9,531
  • 2
  • 40
  • 61
3

you can add a rule in your hosts file: C:\Windows\System32\drivers\etc\hosts

add a rule like

192.168.0.1     myhostname.com

In windows you can't do this with wildcards so for all subdomains you need to add a rule

Tom Vervoort
  • 536
  • 4
  • 11
1

Find your hosts file on your local machine, and then add the following line to it:

192.168.0.1       www.somedomain.com
White Elephant
  • 1,361
  • 2
  • 13
  • 28