LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 08-06-2005, 04:39 PM   #1
gravesb
Member
 
Registered: May 2005
Distribution: Suse 9.3, Gentoo
Posts: 87

Rep: Reputation: 15
apache and /etc/hosts issue


I am doing some APACHE work, and I have an issue. When I type local host, I get whatever webpage I am serving at the time. I updated my /etc/hosts to read as follows

#
# hosts This file describes a number of hostname-to-address
# mappings for the TCP/IP subsystem. It is mostly
# used at boot time, when no name servers are running.
# On small systems, this file can be used instead of a
# "named" name server.
# Syntax:
#
# IP-Address Full-Qualified-Hostname Short-Hostname
#

127.0.0.1 localhost
192.168.123.2 www.butterthlies.com
192.168.123.2 sales.butterthlies.com
192.168.123.3 sales-IP.butterthlies.com
192.168.123.1 www.faraway.com

# special IPv6 addresses
::1 localhost ipv6-localhost ipv6-loopback

fe00::0 ipv6-localnet

ff00::0 ipv6-mcastprefix
ff02::1 ipv6-allnodes
ff02::2 ipv6-allrouters
ff02::3 ipv6-allhosts
127.0.0.2 linux.site linux
~


When I try and go to either www.butterthlies.com or 192.168.123.2, my browser looks to the internet, and finds nothing. Here is my netstat output

Kernel IP routing table
Destination Gateway Genmask Flags MSS Window irtt Iface
192.168.2.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0
169.254.0.0 0.0.0.0 255.255.0.0 U 0 0 0 eth0
127.0.0.0 0.0.0.0 255.0.0.0 U 0 0 0 lo
0.0.0.0 192.168.2.1 0.0.0.0 UG 0 0 0 eth0

I have tried restarting my computer, but it didn't help. Any suggestions?
 
Old 08-06-2005, 05:44 PM   #2
Matir
LQ Guru
 
Registered: Nov 2004
Location: San Jose, CA
Distribution: Debian, Arch
Posts: 8,507

Rep: Reputation: 128Reputation: 128
Because you're pointing those domains to a local ip address.
 
Old 08-06-2005, 06:35 PM   #3
gravesb
Member
 
Registered: May 2005
Distribution: Suse 9.3, Gentoo
Posts: 87

Original Poster
Rep: Reputation: 15
Correct. I am serving the websites from my machine, and would like to view them on my machine. I am learning Apache, not actually creating a site for the Internet. The way I understand things, I should be able to type in the web address, and it will display the web site that I am serving from the same computer. Its not doing that. How can I make those IP's display on my netstat?
 
Old 08-06-2005, 07:49 PM   #4
trickykid
LQ Guru
 
Registered: Jan 2001
Posts: 24,149

Rep: Reputation: 269Reputation: 269Reputation: 269
Quote:
Originally posted by gravesb
Correct. I am serving the websites from my machine, and would like to view them on my machine. I am learning Apache, not actually creating a site for the Internet. The way I understand things, I should be able to type in the web address, and it will display the web site that I am serving from the same computer. Its not doing that. How can I make those IP's display on my netstat?
Most likely since you using a fully qualified domain name and your browser will bypass your /etc/hosts and use your ISP's DNS servers in /etc/resolv.conf.

Perhaps you should create the entries like this:

127.0.0.1 localhost
192.168.123.2 butterthlies.com butterthlies
192.168.123.2 sales.butterthlies.com sales
192.168.123.3 sales-IP.butterthlies.com sales-IP
192.168.123.1 faraway.com faraway

Then you can simply type butterthlies in your browser window or the host name instead of the full name. Either that should work or you can setup your own DNS server to use.
 
Old 08-06-2005, 08:08 PM   #5
Matir
LQ Guru
 
Registered: Nov 2004
Location: San Jose, CA
Distribution: Debian, Arch
Posts: 8,507

Rep: Reputation: 128Reputation: 128
If the computer on which you are browsing has that /etc/hosts (not another computer on the network) then it should work without a hitch. Are you sure there's no firewall in the way?
 
Old 08-07-2005, 12:14 PM   #6
gravesb
Member
 
Registered: May 2005
Distribution: Suse 9.3, Gentoo
Posts: 87

Original Poster
Rep: Reputation: 15
I have a firewall at the router. I don't believe there is one on my machine. Is there anything else that I can check for?
 
Old 08-08-2005, 04:24 PM   #7
Azerix
LQ Newbie
 
Registered: Aug 2005
Distribution: Gentoo
Posts: 6

Rep: Reputation: 0
See if the poort 80 is enabeld in apache2.conf file. Maby is the poort probleem
 
Old 08-08-2005, 08:28 PM   #8
Matir
LQ Guru
 
Registered: Nov 2004
Location: San Jose, CA
Distribution: Debian, Arch
Posts: 8,507

Rep: Reputation: 128Reputation: 128
Please type 'ifconfig -a' and post the results.
 
Old 08-09-2005, 01:06 AM   #9
gravesb
Member
 
Registered: May 2005
Distribution: Suse 9.3, Gentoo
Posts: 87

Original Poster
Rep: Reputation: 15
eth0 Link encap:Ethernet HWaddr 00:11:09D:0F:C0
inet addr:192.168.2.27 Bcast:255.255.255.255 Mask:255.255.255.0
inet6 addr: fe80::211:9ff:fedd:fc0/64 Scope:Link
UP BROADCAST NOTRAILERS RUNNING MULTICAST MTU:1500 Metric:1
RX packets:441 errors:0 dropped:0 overruns:0 frame:0
TX packets:491 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:255803 (249.8 Kb) TX bytes:85502 (83.4 Kb)
Interrupt:177 Base address:0x4000

lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:52 errors:0 dropped:0 overruns:0 frame:0
TX packets:52 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:3360 (3.2 Kb) TX bytes:3360 (3.2 Kb)

sit0 Link encap:IPv6-in-IPv4
NOARP MTU:1480 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:0 (0.0 b) TX bytes:0 (0.0 b)
 
Old 08-09-2005, 12:07 PM   #10
Matir
LQ Guru
 
Registered: Nov 2004
Location: San Jose, CA
Distribution: Debian, Arch
Posts: 8,507

Rep: Reputation: 128Reputation: 128
If your machines IP is 192.168.2.27, why did you lists IPs like 192.168.123.2 in /etc/hosts? Is there another machine on your network with that IP?
 
Old 08-09-2005, 12:53 PM   #11
gravesb
Member
 
Registered: May 2005
Distribution: Suse 9.3, Gentoo
Posts: 87

Original Poster
Rep: Reputation: 15
No, I am working through the examples in Apache: The definitive Guide from O'reilly. Actually, there is another machine, but it is just a windows client
 
Old 08-09-2005, 05:42 PM   #12
Matir
LQ Guru
 
Registered: Nov 2004
Location: San Jose, CA
Distribution: Debian, Arch
Posts: 8,507

Rep: Reputation: 128Reputation: 128
Ok, you can't copy IP addresses straight out of a book unless your network is the same.

Change all those IPs in /etc/hosts to 192.168.2.27.
 
Old 08-09-2005, 11:22 PM   #13
gravesb
Member
 
Registered: May 2005
Distribution: Suse 9.3, Gentoo
Posts: 87

Original Poster
Rep: Reputation: 15
I appreciate the help. I was under the misunderstanding that as long as the IP was 192.168.*.*, my computer would search the local network and then its own hosts file.
 
Old 08-09-2005, 11:34 PM   #14
Matir
LQ Guru
 
Registered: Nov 2004
Location: San Jose, CA
Distribution: Debian, Arch
Posts: 8,507

Rep: Reputation: 128Reputation: 128
Nope. 192.168.*.* IPs are just not "routable": they are reserved for local networks. Take, for example, the case where you have multiple webservers on the same network: it has to pick one, after all.

Glad it got straightened out (it did, right?).
 
Old 08-10-2005, 09:32 AM   #15
gravesb
Member
 
Registered: May 2005
Distribution: Suse 9.3, Gentoo
Posts: 87

Original Poster
Rep: Reputation: 15
Yes, it did. Thanks again.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
apache hosts Henster Linux - Software 1 07-24-2005 05:24 AM
apache 2 virual hosts alaios Linux - Networking 4 06-03-2004 06:48 PM
apache 2 virual hosts alaios Linux - Software 6 05-18-2004 01:05 PM
Apache Virtual Hosts gbg Linux - Software 4 10-02-2003 08:35 AM
Apache virtual hosts Mil0 Linux - Software 5 06-01-2003 11:58 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 03:45 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration