You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Hans Tovetjärn <ha...@mantoray.com> on 2007/12/18 00:43:14 UTC

[users@httpd] Custom hostname and Apache 2.2.6

Hello!

I'm a bit new to this, but here goes. My computer is a MacBook Pro  
with Mac OS X 10.4.11, I am not using the bundled Apach 1.3 server,  
it has not been activated prior to this. I installed Apache 2.2.6 (as  
well as PHP and MySQL...) through MacPorts (DarwinPorts) and it has  
been working flawlessly. It is when I attempt the following I can't  
make it work.

I have a fancy prompt in Terminal, which displays  
"username@hostname>", however, I would like the hostname to be the  
computer name, i.e. I want it to look like "hans@laptop>", because  
the current hostname is "host-xx-xxx-xx-xxx" which can clutter up the  
screen a bit too much for me. Now this I solved by typing...

	> sudo hostname laptop

...but after that, I can't seem to start Apache. If I change it back  
to "host-xx-xxx-xx-xxx", all is well. But I want the short name, so I  
try again. The error message I get is as follows:

	httpd: apr_sockaddr_info_get() failed for laptop
	httpd: Could not reliably determine the server's fully qualified  
domain name, using 127.0.0.1 for ServerName

This is supposedly merely a warning according to http:// 
wiki.apache.org/httpd/CouldNotDetermineServerName but if I open my  
browser and go to 127.0.0.1 it can't find the server. Nor can I see  
it listed if I do a

	> ps aux | grep httpd

So it would seem it never started at all. I then tried setting my  
hostname in httpd.conf to the following and restarting Apache 2,  
without success:

	laptop
	127.0.0.1
	host-xx-xxx-xx-xxx (my old hostname)
	127.0.0.1:80
	host-xx-xxx-xx-xxx:80
	host-xx-xxx-xx-xxx.serva.net (ISP)

None of them worked, I tried changing the listen directive as well to  
my IP, but that wouldn't help me either. Is it possible to use a  
custom hostname and have Apache run simultaneously?

Thanks in advance.

Regards,

Hans



Re: [users@httpd] Custom hostname and Apache 2.2.6

Posted by Karel Kubat <ka...@e-tunity.com>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi Hans,

On Dec 18, 2007, at 12:43 AM, Hans Tovetjärn wrote:

> I'm a bit new to this, but here goes. My computer is a MacBook Pro  
> with Mac OS X 10.4.11, I am not using the bundled Apach 1.3 server,  
> it has not been activated prior to this. I installed Apache 2.2.6  
> (as well as PHP and MySQL...) through MacPorts (DarwinPorts) and it  
> has been working flawlessly. It is when I attempt the following I  
> can't make it work.
>
> I have a fancy prompt in Terminal, which displays  
> "username@hostname>", however, I would like the hostname to be the  
> computer name, i.e. I want it to look like "hans@laptop>", because  
> the current hostname is "host-xx-xxx-xx-xxx" which can clutter up  
> the screen a bit too much for me. Now this I solved by typing...
>
> 	> sudo hostname laptop
>
> ...but after that, I can't seem to start Apache. If I change it  
> back to "host-xx-xxx-xx-xxx", all is well. [...]

On my Tiger system, start System Preferences -> Sharing (which is in  
the tab Internet & Network) and set your hostname there. The bare  
Unix 'hostname' command isn't the only place where MacOSX keeps the  
name of the system. The Preferences pane updates all.

Hope this helps,
    --
    Karel Kubat / M +31 6 2956 4861 (+31 6 AWK 6 HUM 1)
    From the duffynitions collection:
    Catifornia: The sunshine State for cats.

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (Darwin)

iD8DBQFHZ3yE23FrzRzybNURAtfOAJ9JCbvcSfvf8BXXbIj7Fpyd1tsaPwCePg7v
lwZkzrTfKKYZnCYQXM/+lyw=
=iE8t
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
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
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Custom hostname and Apache 2.2.6

Posted by Hans Tovetjärn <ha...@mantoray.com>.
Hello!

> That's not an Apache issue at all it is basic networking  
> configuration at the OS level.
>
> What you need is to get a good book on Unix system administration,  
> hopefully one aimed at your particular OS.
>
> Dragon

What I from start didn't know I wanted to change, is as you say  
networking configuration. I thought this was because of Apache, but  
having done some simple tests later on I found out it wasn't related  
to Apache at all. Hence Karel Kubat was right too, just like Axel- 
Stephane Smorgrav, thanks to both of you. I'm on the right track now  
for what I want to tweak, now knowing partially how these things  
work, and found myself some UNIX tutorials and fora to learn from.

Thanks again all!

Regards,

Hans


---------------------------------------------------------------------
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
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Custom hostname and Apache 2.2.6

Posted by Dragon <dr...@crimson-dragon.com>.
Hans Tovetjärn wrote:
>Hello!
>
>Thank you, it worked! It does give me the 
>warning, but that is perhaps not a big issue. 
>This is really a jungle to me right now though, 
>in what part of the Apache documentation can I read more about this?
>
>>In that case there is maybe another way around it.
>>
>>In /etc/hosts, change the line
>>
>>127.0.0.1localhost
>>
>>into
>>
>>127.0.0.1localhost laptop
>>
>>That should keep Apache happy.
>>
>>
>>-ascs
>
>Regards,
>
>Hans
---------------- End original message. ---------------------

That's not an Apache issue at all it is basic 
networking configuration at the OS level.

What you need is to get a good book on Unix 
system administration, hopefully one aimed at your particular OS.

Dragon

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  Venimus, Saltavimus, Bibimus (et naribus canium capti sumus)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


---------------------------------------------------------------------
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
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


RE: [users@httpd] Custom hostname and Apache 2.2.6

Posted by Axel-Stephane SMORGRAV <Ax...@europe.adp.com>.
I do not know whether there is anything about this in the doc. 

Looking at the source code (server/util.c and server/vhost.c) I figured out that Apache at some point tries to resolve the address associated with the host name on which it is running. Normally this does not pose any problem because that info is in the /etc/hosts file, but in your case, since both the host name and the associated IP address are served dynamically by DHCP and does not resolve through DNS, you were stuck.

So the important thing is for Apache to resolve the address associated with the host name. In your case I figured that the easiset way to achieve this was to add the host name to an existing entry in /etc/hosts.

-ascs
________________________________

De : Hans Tovetjärn [mailto:hans@mantoray.com] 
Envoyé : mardi 18 décembre 2007 09:30
À : users@httpd.apache.org
Objet : Re: [users@httpd] Custom hostname and Apache 2.2.6


Hello! 

Thank you, it worked! It does give me the warning, but that is perhaps not a big issue. This is really a jungle to me right now though, in what part of the Apache documentation can I read more about this?


---------------------------------------------------------------------
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
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Custom hostname and Apache 2.2.6

Posted by Hans Tovetjärn <ha...@mantoray.com>.
Hello!

Thank you, it worked! It does give me the warning, but that is  
perhaps not a big issue. This is really a jungle to me right now  
though, in what part of the Apache documentation can I read more  
about this?

> In that case there is maybe another way around it.
>
> In /etc/hosts, change the line
>
> 127.0.0.1	localhost
>
> into
>
> 127.0.0.1	localhost laptop
>
> That should keep Apache happy.
>
>
> -ascs

Regards,

Hans


RE: [users@httpd] Custom hostname and Apache 2.2.6

Posted by Axel-Stephane SMORGRAV <Ax...@europe.adp.com>.
In that case there is maybe another way around it.

In /etc/hosts, change the line

127.0.0.1	localhost

into 

127.0.0.1	localhost laptop

That should keep Apache happy.


-ascs
 
-----Message d'origine-----
De : Hans Tovetjärn [mailto:hans@mantoray.com] 
Envoyé : mardi 18 décembre 2007 09:10
À : users@httpd.apache.org
Objet : Re: [users@httpd] Custom hostname and Apache 2.2.6

Hello,

there is no such line in /etc/hosts, unfortunately:

"##
# Host Database
#
# localhost is used to configure the loopback interface # when the system is booting.  Do not change this entry.
##
127.0.0.1	localhost
255.255.255.255	broadcasthost
::1             localhost "

My IP is recieved through DHCP, so I'm not sure if it's permanent? As for the advice regarding setting my computer name in the System Preferences pane, I have already done that, but it doesn't seem to affect the \u in terminal.


> Here's a shot in the dark.
>
> The file /etc/hosts most probably has a line containing host-xx-xxx- 
> xx-xxx, associating the host name with an IP address, looking somewhat 
> like this:
>
> 10.11.12.14 host-xx-xxx-xx-xxx
>
> Edit that line and add laptop:
>
> 10.11.12.14 host-xx-xxx-xx-xxx laptop
>
>
> I think that should do the trick. In order to permanently change the 
> hostname, I believe you would need to modify the file /etc/ hostname 
> and/or /etc/nodename. You would need root privileges for that.
>
>
> -ascs

Regards,

Hans


---------------------------------------------------------------------
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
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


---------------------------------------------------------------------
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
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Custom hostname and Apache 2.2.6

Posted by Hans Tovetjärn <ha...@mantoray.com>.
Hello,

there is no such line in /etc/hosts, unfortunately:

"##
# Host Database
#
# localhost is used to configure the loopback interface
# when the system is booting.  Do not change this entry.
##
127.0.0.1	localhost
255.255.255.255	broadcasthost
::1             localhost "

My IP is recieved through DHCP, so I'm not sure if it's permanent? As  
for the advice regarding setting my computer name in the System  
Preferences pane, I have already done that, but it doesn't seem to  
affect the \u in terminal.


> Here's a shot in the dark.
>
> The file /etc/hosts most probably has a line containing host-xx-xxx- 
> xx-xxx, associating the host name with an IP address, looking  
> somewhat like this:
>
> 10.11.12.14 host-xx-xxx-xx-xxx
>
> Edit that line and add laptop:
>
> 10.11.12.14 host-xx-xxx-xx-xxx laptop
>
>
> I think that should do the trick. In order to permanently change  
> the hostname, I believe you would need to modify the file /etc/ 
> hostname and/or /etc/nodename. You would need root privileges for  
> that.
>
>
> -ascs

Regards,

Hans


---------------------------------------------------------------------
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
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


RE: [users@httpd] Custom hostname and Apache 2.2.6

Posted by Axel-Stephane SMORGRAV <Ax...@europe.adp.com>.
Here's a shot in the dark.
 
The file /etc/hosts most probably has a line containing host-xx-xxx-xx-xxx, associating the host name with an IP address, looking somewhat like this:

10.11.12.14 host-xx-xxx-xx-xxx

Edit that line and add laptop:

10.11.12.14 host-xx-xxx-xx-xxx laptop


I think that should do the trick. In order to permanently change the hostname, I believe you would need to modify the file /etc/hostname and/or /etc/nodename. You would need root privileges for that.
 

-ascs

________________________________

De : Hans Tovetjärn [mailto:hans@mantoray.com] 
Envoyé : mardi 18 décembre 2007 00:43
À : users@httpd.apache.org
Objet : [users@httpd] Custom hostname and Apache 2.2.6


Hello! 

I'm a bit new to this, but here goes. My computer is a MacBook Pro with Mac OS X 10.4.11, I am not using the bundled Apach 1.3 server, it has not been activated prior to this. I installed Apache 2.2.6 (as well as PHP and MySQL...) through MacPorts (DarwinPorts) and it has been working flawlessly. It is when I attempt the following I can't make it work.

I have a fancy prompt in Terminal, which displays "username@hostname>", however, I would like the hostname to be the computer name, i.e. I want it to look like "hans@laptop>", because the current hostname is "host-xx-xxx-xx-xxx" which can clutter up the screen a bit too much for me. Now this I solved by typing...

> sudo hostname laptop

...but after that, I can't seem to start Apache. If I change it back to "host-xx-xxx-xx-xxx", all is well. But I want the short name, so I try again. The error message I get is as follows:

httpd: apr_sockaddr_info_get() failed for laptop 
httpd: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1 for ServerName

This is supposedly merely a warning according to http://wiki.apache.org/httpd/CouldNotDetermineServerName but if I open my browser and go to 127.0.0.1 it can't find the server. Nor can I see it listed if I do a

> ps aux | grep httpd


So it would seem it never started at all. I then tried setting my hostname in httpd.conf to the following and restarting Apache 2, without success:

laptop

127.0.0.1

host-xx-xxx-xx-xxx (my old hostname)

127.0.0.1:80

host-xx-xxx-xx-xxx:80
host-xx-xxx-xx-xxx.serva.net (ISP)

None of them worked, I tried changing the listen directive as well to my IP, but that wouldn't help me either. Is it possible to use a custom hostname and have Apache run simultaneously?

Thanks in advance.

Regards,

Hans



---------------------------------------------------------------------
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
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org