LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 11-06-2005, 09:11 AM   #1
mikebua56
LQ Newbie
 
Registered: Nov 2005
Location: Florida
Distribution: SUSE 9.3
Posts: 4

Rep: Reputation: 0
Changing Hostname to Domain Name


I have a web server running on SUSE 9.3 using Apache 2.0, MySQL, and PHP4.

I am having issues setting up a Postfix Mail Server, in addition to getting SSL running on my website. There appears to be a conflict because my hostname/domain name in my linux box, doesn't match the domain name of my site.

For example, in my hosts file I have the standard //localhost/ at IP 127.0.0.1

However, there is a hostname/domainname of linux.site at 127.0.0.2

hostname = linux
domainname = site

My domain name is of coure something like mydomain .com

I tried changing this hostname "linux.site" to www dot mydomain dot com

I also added a hostname for a mail server at 127.0.0.3 such as:
mail.mydomain .com

I used the YAST2 GUI interface "Network Services" - "DNS and Host Name", to change these

However, when I changed the linux.site, most of the KDE desktop stuff stopped working and I had problems with apache.

I changed the linux.site bak to what it was originally and got everything running again.

I had to turn off SSL in apache and delete the vhosts-ssl.conf file, as it appeared to have some funny things going on in it. But that's probably a separate issue.

I guess my questions at this point are:
1) What is this hostname used for, and how can I safely change it?
2) Should this hostname match the hostname/domain name of my website
3) Do I need to set up a separate hostname for a Postfix mail server?
4) To configure mod_ssl, does my does my hostname/domain name on my box need to match my the domain name of my site?
 
Old 11-06-2005, 06:53 PM   #2
MasterC
LQ Guru
 
Registered: Mar 2002
Location: Salt Lake City, UT - USA
Distribution: Gentoo ; LFS ; Kubuntu
Posts: 12,612

Rep: Reputation: 68
Re: Changing Hostname to Domain Name

Quote:
Originally posted by mikebua56
[SNIP]

I guess my questions at this point are:
1) What is this hostname used for, and how can I safely change it?
2) Should this hostname match the hostname/domain name of my website
3) Do I need to set up a separate hostname for a Postfix mail server?
4) To configure mod_ssl, does my does my hostname/domain name on my box need to match my the domain name of my site?
1. It's used to define a hostname For Home/Small Office use (maybe even large?) it's used to define machines by something other than their local IP. If you've got a group of computers, for humans, it's (usually) easier to remember that the one in the closet is "homer" and the one in the basement is "oscar" and so on, rather than, the one in the basement is 192.168.1.20 the in the closet is 192.168.1.22 and so on... To safely change it, you can either use the hostname command, but this won't last through a restart. Depending on your distro, you can define it at /etc/hostname /etc/conf.d/hostname /etc/rc.d/rc.hostname (check your distros documentation for more info on defining a hostname). If you want to just do it a generic way, you can play the hostname command in your rc.local file (somewhere in your /etc directory):
hostname newhostname
Is the syntax.

2. The hostname is not dependent upon anything, and the website should not be dependent upon the hostname. Outside of your network, defining that computer should look something like oscar.yourwebsite.com Or, in the case of a mail server, it's often seen as mail.yourwebsite.com therefore you'd give that server the hostname of 'mail', but this is NOT required, it's simply 'common'.

3. Um, sorta. You need to define a hostname and domain name within the postfix main.cf file. They should simply match what you have. So, if your domain is something.com and your mail server is oscar:
myhostname=oscar
mydomain=something.com
Would be an example of the entries in your main.cf file.

4. I'm sorry, I don't use mod_ssl, so I really can't give good info on that. However, I believe for your certificate to be considered valid at all that the short answer is 'yes'. I really don't know, but I have seen the invalid cert dialogue and have done some (very little) stuff with ssl, and this would make sense.


It seems that maybe there is some confusion as to how your applications resolve to your server. Most of the time they do this through your DNS server, if that's a local server (Bind) then you will setup corresponding entries in your db entries. If not, and your DNS server is something like zoneedit.com then you need to set that up accordingly. Either way, your DNS server will resolve the hostname(s) and domain(s) on your network to the corresponding computers (or servers if you like). Your router (if you have one) will resolve the port-host via the port-forwarding section. If you don't have a router, and your server is the WAN IP's destination, then your hosts file will resolve those private IP's.

Clear as mud? Probably. I'll be happy to break it down a bit better, but I'm sure there is a networking guru out there who can do a MUCH better job than I. Another option is to pick up a book (either buy it, or grab it from the Library) on DNS, my personal favorite and bible is the one from Oreilly, DNS and Bind. It's been great for my questions regarding how resolving works.

Anyway, as a last 'note' I suggest not using Loopback addresses, they just tend to cause confusion when learning how this all works (IMHO). I use real LAN/private IP's, even if that means a line like this in hosts:
192.168.1.98 mail ns1 oscar
Which will define mail.something.com ns1.something.com and oscar.something.com It just makes a lot more sense than defining multiple Loopback addresses for the same machine.

Good Luck!

Cool
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Changing server hostname and domain name defa0009 Linux - Networking 1 11-11-2005 07:57 PM
What is the difference between domain name and hostname? davidas Linux - Newbie 9 04-23-2004 01:38 PM
Wrong Hostname in a MS Domain Zeb Linux - Networking 0 03-16-2004 03:32 AM
Want to set up a new domain name and hostname? hamster Linux - Networking 6 04-06-2003 12:04 PM
hostname vs domain racediver007 Linux - Newbie 5 03-20-2003 03:30 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 07:14 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration