Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to assign hostname to the web server?

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.

like image 808
Mahendra Liya Avatar asked Jan 21 '23 12:01

Mahendra Liya


1 Answers

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
like image 70
YasirA Avatar answered Feb 05 '23 03:02

YasirA