Hi guys,

I want to access my virtual domain from another computer on same network by typing www.site1.com or site1.com without using IP at the beginning of URL.

Currently it works this way:

Server computer where Apache is running: www.site1.com AND site1.com works fine as I want.
Another desktop computer on same LAN : http://192.168.31.28/site1.com/htdocs works only this way.

What should I do to remove that IP from URL and htdosc bit?

I added my configuraton so you know what I did. I use Ubuntu 10.10

Thanks in advance

/etc/apache2/sites-availabe/site1.com.conf

<VirtualHost *:80>
	ServerName	site1.com
	ServerAlias	www.site1.com
	DocumentRoot	/var/www/site1.com/htdocs

	ServerAdmin	admin@site1.com
	ErrorLog	/var/log/apache2/site1.com_error-log
	CustomLog	/var/log/apache2/site1.com_custom-log	common
</VirtualHost>

/etc/hosts

192.168.31.28	ubuntu	# Added by NetworkManager
127.0.0.1	localhost.localdomain	localhost
::1	ubuntu	localhost6.localdomain6	localhost6
10.0.0.2	#ubuntu
127.0.0.1	site1.com	www.site1.com

I created link in /etc/apache2/sites-enabled
I did sudo a2ensite site1.com.conf
I have bind9 installed, if it helps.

Extra information:

myname@ubuntu:~$ sudo ifconfig eth0
eth0      Link encap:Ethernet  HWaddr 54:42:49:87:10:e6  
          inet addr:192.168.31.28  Bcast:192.168.31.255  Mask:255.255.255.0
          inet6 addr: fe80::5642:49ff:fe87:10e6/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:45807 errors:0 dropped:0 overruns:0 frame:0
          TX packets:4279 errors:0 dropped:0 overruns:0 carrier:7
          collisions:0 txqueuelen:1000 
          RX bytes:4439887 (4.4 MB)  TX bytes:609477 (609.4 KB)
          Interrupt:49

It looks like your DNS configuration may need changing as your URL isn't being resolved across the LAN. Check your named.conf file and set up your forward and reverse lookup zones.

This link seems to answer what you're asking :)

Thanks for reply guys. When I get back home from holiday, I'll try ıt and let you know about it. Thanks

Hi again guys,

1. I addedd 192.168.31.28 www.site1.com to hosts but nothing changed.


2. I add my named.conf file. What exactly do I need to add to it?

Thanks

named.conf

// prime the server with knowledge of the root servers
zone "." {
	type hint;
	file "/etc/bind/db.root";
};

// be authoritative for the localhost forward and reverse zones, and for
// broadcast zones as per RFC 1912

zone "localhost" {
	type master;
	file "/etc/bind/db.local";
};

zone "127.in-addr.arpa" {
	type master;
	file "/etc/bind/db.127";
};

zone "0.in-addr.arpa" {
	type master;
	file "/etc/bind/db.0";
};

zone "255.in-addr.arpa" {
	type master;
	file "/etc/bind/db.255";
};

This is how I access from another computer at the moment:
http://192.168.31.28/site1.com/htdocs/

I prefer www.site1.com and/or site1.com

Not sure if you have solved this yet but I may not have made it clear that the entry for the etc/hosts file goes on the PC that you are trying to access the site from as opposed to the server. That way when you enter the domain-name on the Workstation it pulls the IP address from etc hosts instead of looking the address up via DNS. Hope that helps.

Ahaaa. Sounds like, all the client machines should have hosts file with correct settings. Setting it up on server machine only is not enough then. Thanks for info rch

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.