Welcome Guest | Login

a newbie question about hostname

I don't know if this is the best place to learn about this, but I don't know where to look for this information.

I would like to learn how hostname works or how to change it (I don't have cpanel with my vps plan if cpanel is how you do it). When I signed up for vps hosting I selected the hostname 'foo.bar.com' (not the actual name). Later I bought the domain 'abcd.com' and that's what I would like my hostname to be.

While setting up Apache2 I needed to restrict some stuff to only work from the local virtual machine (abcd.com points to the ip for the virtual machine), but it doesn't work unless I use hostname 'foo.bar.com' in my apache config

I understand that selecting 'foo.bar.com' was foolish, because I don't have that domain (bar.com), but I thought I could change /etc/hostname and that would take care of it. I tried changing it to 'abcd.com', but it reverts to 'foo.bar.com' after reboot.




2008-06-23 08:42 PM

You can edit the file /etc/hostname to change the hostname and then run:

/etc/init.d/hostname.sh start

2008-06-23 09:15 PM

Thanks for the suggestion.

I tried doing it, but it didn't work. Running 'hostname' gives the new name, but running something like 'ping localhost' shows the request coming from the old hostname.

2008-06-23 09:42 PM

You can add the new hostname in /etc/hosts file as below.
--------
127.0.0.1 <newhostname>

2008-06-24 12:40 AM


Hello Guest! In order to post you must be an active client with us, please log in or sign up today!