You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Paul Robinson <pa...@eserv.com.au> on 2002/02/27 12:55:02 UTC

ServerName directive..

Hi guys/gals,

I have a small problem where I dont want to have to define my server name,
and i dont want apache to "figure" it out either. I'll explain the problem
in full later, but i've been unable to find a way to make apache not send
back a 300 error telling me to go to http://server.defined.name/ when ever i
hit the web server... i.e. i just want it to take requests on port 80, on
ever ip on the machine without it worrying about what hostname was used to
get to it in the first place... Am i making sence? If so, is there a way
around this problem? (version 1.3.12 on linux, redhat 6.2, running 2.4.9
kernel)


In more depth:

For example...

# telnet localhost 80
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
GET / HTTP/1.0

HTTP/1.1 301 Moved Permanently
Location: http://server.defined.name/
Connection: close
Content-Type: text/html; charset=iso-8859-1

As you can see, it tries to make me come in via the server name defined by
the ServerName in the config file, if i leave out the server name, then it
starts to guess (and gets the internal server name, unfortunately, but i do
know why that is, so thats ok).

The problem is this, when i use my laptop to access the machine internally
on my lan, it sends back that url, and if my machine is connected to adsl,
then no worries, it'll take me there, otherwise, it just times out trying to
resolve a name defined externally. I also dont want to define the server
name in my hosts file (of my laptop) with my internal ip address cause when
im on the move, its obviously not going to work. One of the obvious
solutions to the problem is to perhaps define a virtual host for my internal
ip, But im hoping there's an easier answer?

Lastly, i cant use an ip address in the servername field for 2 reasons, 1)
if i define it as my internal (static) ip address, then i'll never be able
to get to it from the outside and 2) the external ip address is dynamic...
(i use a dyndns.org name space, hence if the external link is down, i can
never get to the site at all) and i'd really not like to write some dodgey
script to update my config file everytime it changes (specially if im off
the air).

Anyone got any suggestions?? Thanks in advance...

Re: ServerName directive..

Posted by Owen Boyle <ob...@bourse.ch>.
> Paul Robinson wrote:
> 
> Hi guys/gals,
> 
> I have a small problem where I dont want to have to define my server
> name, and i dont want apache to "figure" it out either. I'll explain
> the problem in full later, but i've been unable to find a way to make
> apache not send back a 300 error telling me to go to
> http://server.defined.name/ when ever i hit the web server... i.e. i
> just want it to take requests on port 80, on ever ip on the machine
> without it worrying about what hostname was used to get to it in the
> first place... Am i making sence? If so, is there a way around this
> problem? (version 1.3.12 on linux, redhat 6.2, running 2.4.9 kernel)

Try "UseCanonicalName off". Check the docs for this and ServerName to
see what's happening and why.

Rgds,

Owen Boyle.

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org