not able to access web server through hostname
Added by mliya over 14 years ago
I am using using Linux 2.6.32 and Lighttpd 1.4.28.
I want to access my web pages by using the hostname and not IP.
I am not able to do it.
Can anyone help me with it?
Thanks.
Replies (5)
RE: not able to access web server through hostname - Added by tomkap over 14 years ago
You need a dns server to resolve the hostname to your IP for every computer in your network, or just edit /etc/hosts and insert a line "ip hostname". ip = your lighttpd working IP, hostname = the hostname you want (e.g. 127.0.0.1 imaserver.lan)
RE: not able to access web server through hostname - Added by mliya over 14 years ago
Hey,
Thank you for your reply.
I have added the hostname in /etc/hosts as:
192.168.1.249 localhost.localdomain mynewhost.com localhost4
This make the webpages accessible by url: http://mynewhost.com/index.html from ONLY my machine.
However, when I try to access the webpages from other machines, using the same URL, I am not able to access the pages.
Do you have any idea whats going wrong?
Thanks.
RE: not able to access web server through hostname - Added by tomkap over 14 years ago
mliya wrote:
Hey,
Thank you for your reply.
I have added the hostname in /etc/hosts as:
192.168.1.249 localhost.localdomain mynewhost.com localhost4
This make the webpages accessible by url: http://mynewhost.com/index.html from ONLY my machine.
However, when I try to access the webpages from other machines, using the same URL, I am not able to access the pages.
Do you have any idea whats going wrong?
Thanks.
As I said, you need a dns server to resolve this hostname in your network. However, you can use the same solution to all machines of your network (I talk about /etc/hosts).
RE: not able to access web server through hostname - Added by mliya over 14 years ago
I am not sure, if I want to manually configure the DNS server to resolve this hostname, probably I need edit /etc/resolv.conf file.
However, I don't know how should I put the entries in another machine so that it resolves my custom hostname.
Can you show me some sample setting which I should write in another machine on the same network?
Thanks.
RE: not able to access web server through hostname - Added by nitrox over 14 years ago
dnsmasq might be handy - read the docs/howtos. This has nothing to with lighty tho.