Click to See Complete Forum and Search --> : Apache on Red Hat


laverda
08-23-2001, 02:24 PM
When starting Apache I get an error saying that it does not recognize the hostname (which is: darkstar) and sets the default to 127.0.0.1 so when I go to a broswer and type http://darkstar/ nothing comes up but when i type http://127.0.0.1 my homepage comes up. I installed the latest version off apache from apache.org. I left everything as default. Can someone tell me whats going on? :confused:

wurmy
08-23-2001, 07:15 PM
you probably have to set up a domain name...if i remember correctly i had this problem too on my first attempt at setting up a webserver. get a domain name set up and point it to your ip and you should have no problem....
theoretically and assuming im right...
anyone got any other ideas?

SKoL
08-23-2001, 07:23 PM
If you are running RH 7.1 I'm not EXACTLY sure where the default apache is (I always install the sorce from www.apache.org), (http://www.apache.org),) can't remember if its

/var/www

or /var/httpd

Anyways, you can do a

#locate httpd.conf

edit the configuration file for apache (httpd.conf) with pico or something,

#pico -w httpd.conf


hit Control-W , then type ServerRoot hit enter.

That will bring to you this line in your configuration file.



#
# ServerName allows you to set a host name which is sent back to clients for
# your server if it's different than the one the program would get (i.e., use
# "www" instead of the host's real name).
#
# Note: You cannot just invent host names and hope they work. The name you
# define here must be a valid DNS name for your host. If you don't understand
# this, ask your network administrator.
# If your host doesn't have a registered DNS name, enter its IP address here.
# You will have to access it by its address (e.g., http://123.45.67.89/)
# anyway, and this will make redirections work in a sensible way.
#
# 127.0.0.1 is the TCP/IP local loop-back address, often named localhost. Your
# machine always knows itself by this address. If you use Apache strictly for
# local testing and development, you may use 127.0.0.1 as the server name.
#
ServerName skol.dhs.org

ServerName skol.dhs.org

See that bold part above? change that to something. It dosen't have to be a FQDN or a dns name like above.

[ 23 August 2001: Message edited by: SKoL ]

[ 23 August 2001: Message edited by: SKoL ]

laverda
08-23-2001, 08:03 PM
Since my post I've have edit httpd.conf so the line servername looks like this

ServerName darkelf

I am running Red Hat 7.1 and Apache 1.3.2. I am still having the same problem as above. Except when I start apache this time it does not give me an error message, but when I open Netscape and type http://darkelf I still get that it cant find http://darkelf, but when I type http://127.0.0.1 I get my default web page.

WilliamWallace
08-23-2001, 11:44 PM
darkelf is not a fully qualified domain name. try using localhost....or if you have a domain name...use that. you can even do a whois on your ip and see what you get.

Craig McPherson
08-29-2001, 12:07 AM
C'mon, people. Isolate.

It's not an Apache problem. It's a DNS problem. The name just isn't resolving to an IP. No amount of fiddling with Apache is going to change the way your system looks up hostnames.

The simplest thing to do is just add the hostname to /etc/hosts. You could also run a full DNS server, but that'd be a bit excessive for just one hostname.

Craig McPherson
08-29-2001, 12:11 AM
Remember that behavior for looking up hostnames is determined by /etc/nsswitch.conf, with the default setting (on all distros that I've used) being "files dns" which means to check /etc/hosts first, and if the name can't be found there, to use a DNS server (as defined in /etc/resolv.conf -- the DNS server can of course be running on the local machine) to look up the name. You can change this, of course, or look up names via nis, ldap, or all kinds of other crazy stuff.