Welcome to WebmasterWorld Guest from 220.127.116.11
First, you can't use "localhost" as a name unless it appears in your hosts file, so check that first -- if you use 127.0.0.1 instead of localhost and it works, either use the IP or correct your hosts file.
Several Apache httpd.conf directives control interface binding, by default it will bind to all TCP/IP interfaces, but check if any of these directives have a value:
# Listen: Allows you to bind Apache to specific IP addresses and/or
# ports, in addition to the default. See also the <VirtualHost>
# BindAddress: You can support virtual hosts with this option. This directive
# is used to tell the server which IP address to listen to. It can either
# contain "*", an IP address, or a fully qualified Internet domain name.
# See also the <VirtualHost> and Listen directives.
The above directives are commented out to bind to all addresses (including 127.0.0.1) -- the listen port is specified with the Port directive:
# Port: The port to which the standalone server listens.
if Port is commented out it defaults to 80.
ServerName also impacts how the server responds:
# 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., [18.104.22.168...]
# anyway, and this will make redirections work in a sensible way.
ServerName should be "*" unless you understand how it works with any other value.