LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 02-09-2006, 11:36 AM   #1
stormrider_may
Member
 
Registered: Sep 2005
Distribution: Debian
Posts: 304

Rep: Reputation: 30
Getting nuts. Can't receive e-mail and can't configure a dns server (virtual host)


Please!!!! i really need help!!!

Look, i just can't config a virtual host on apache. What i need is simples, people who access www.demorgan.com.br go to http://my_ip/demorgan/ but people who are accessing www.demorgan.com.br are getting into http://my_ip/

Dns looks like this:

Code:
$TTL    86400
; Authoritative data for demorgan.com.br
;
@                IN       SOA localhost. root.demorgan.com.br. (
                                2004102897      ; Serial (yymmddxx)
                                10800           ; Refresh 3 hours
                                3600            ; Retry   1 hour
                                36000           ; Expire  10 hours
                                86400 )         ; Minimum 24 hours
                 IN       NS            ns1.demorgan.com.br.
                 IN       NS            ns2.demorgan.com.br.
200.138.31.116  IN MX 10 demorgan.com.br.
www           IN       A             200.138.31.116
ns1           IN       A             200.138.31.116
ns2           IN       A             200.138.31.116

Apache looks like this:

Code:
NameVirtualHost 200.138.31.116
<VirtualHost 200.138.31.116>
   ServerName www.demorgan.com.br
   DocumentRoot "/var/www/demorgan"
</VirtualHost>
Second problem

I can send e-mail using postfix without any problems but i'm not receiving e-mails...

I think this a dns problem. Look at the configuration above, is it right?
 
Old 02-09-2006, 11:58 AM   #2
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,175
Blog Entries: 1

Rep: Reputation: 2042Reputation: 2042Reputation: 2042Reputation: 2042Reputation: 2042Reputation: 2042Reputation: 2042Reputation: 2042Reputation: 2042Reputation: 2042Reputation: 2042
Quote:
I can send e-mail using postfix without any problems but i'm not receiving e-mails...
I think this a dns problem. Look at the configuration above, is it right?
That's because you didn't setup an MX record correctly in your zone file:
Code:
IN       MX 10            demorgan.com.br.
As for the virtual server problem I don't see any difference between the 2 URLs
 
Old 02-09-2006, 12:10 PM   #3
stormrider_may
Member
 
Registered: Sep 2005
Distribution: Debian
Posts: 304

Original Poster
Rep: Reputation: 30
Ok, let me explain better about the virtual host.

On http://my_ip/ I have a site. I will be host www.demorgan.com.br, but the files for this site are in http://my_ip/demorgan/.

Using this dns conf, when someone try to access www.demorgan.com.br they get into http://my_ip/ (which is another site) and not into http://my_ip/demorgan/
 
Old 02-09-2006, 12:19 PM   #4
stormrider_may
Member
 
Registered: Sep 2005
Distribution: Debian
Posts: 304

Original Poster
Rep: Reputation: 30
Ok, this is the error i get when i send a e-mail (using gmail for example) for my domain.

Code:
This is an automatically generated Delivery Status Notification

Delivery to the following recipient failed permanently:

     demorgan@demorgan.com.br

Technical details of permanent failure: 
PERM_FAILURE: DNS Error: DNS server returned answer with no data
On postfix, things are like this..

Code:
Feb  9 16:20:02 localhost postfix/pickup[11873]: 3C17A9E24: uid=105 from=<smmsp>
Feb  9 16:20:02 localhost postfix/cleanup[12156]: 3C17A9E24: message-id=<20060209182002.3C17A9E24@demorgan.com.br>
Feb  9 16:20:02 localhost postfix/qmgr[8498]: 3C17A9E24: from=<smmsp@demorgan.com.br>, size=624, nrcpt=1 (queue active)
Feb  9 16:20:02 localhost postfix/local[12163]: warning: dict_nis_init: NIS domain name not set - NIS lookups disabled
Feb  9 16:20:02 localhost postfix/local[12163]: 3C17A9E24: to=<root@demorgan.com.br>, orig_to=<root>, relay=local, delay=0, status=sent (delivered to command: procmail -a "$EXTENSION")
Feb  9 16:20:02 localhost postfix/qmgr[8498]: 3C17A9E24: removed
Is it normal?
 
Old 02-09-2006, 12:41 PM   #5
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,175
Blog Entries: 1

Rep: Reputation: 2042Reputation: 2042Reputation: 2042Reputation: 2042Reputation: 2042Reputation: 2042Reputation: 2042Reputation: 2042Reputation: 2042Reputation: 2042Reputation: 2042
1. For thhe DNS problem:
Did you change your zone file, increase the serial and restart bind? Edit the zone file changing the following lines:
Code:
                                2006020901      ; Serial (yymmddxx)
...
  IN       MX 10            demorgan.com.br.
  IN       A     200.138.31.116
...
I haven't use postfix so I cannot understand the logfile but the error message is obvious
2. About vhost
If /var/www is your DocumentRoot then rename your server to something else(i.e. ServerName www1.demorgan.com.br) so when someone visits www1.demorgan.com.br goes to /var/www and when he visits www.demorgan.com.br goes to /var/www/demorgan, but I think it's better to use a different directory for each vhost(i.e. something like /var/www/default for www1 and /var/www/demorgan for www)
 
Old 02-09-2006, 02:56 PM   #6
Darin
Senior Member
 
Registered: Jan 2003
Location: Portland, OR USA
Distribution: Slackware, SLAX, Gentoo, RH/Fedora
Posts: 1,024

Rep: Reputation: 45
Code:
<VirtualHost www.demorgan.com.br>
   ServerName www.demorgan.com.br
   DocumentRoot "/var/www/demorgan"
</VirtualHost>
The paramater for the VirtualHost entry is what tells Apache that requests for this URL go to the specified directory, the ServerName entry is just what Apache reports back to the client, *after* it has fulfilled the request.

As a note, typically a virtual host is for a unique directory, not one in another web site's subdirectory. So if you have a web server hosting two sites, site A would be someplace like /var/www/htdocs_site_a and site B would be /var/www/htdocs_site_b, not /var/www/htdocs_site_a/subdirectory_b.

As long as the appropriate domain names resolve to the correct IP address(es) then DNS should not be an issue for the web sites.

Mail is something I don't know enough about to comment on, but it looks like others have helped address your issues there. For the DNS aspect, I'd have something like this in the zonefile:
Code:
$TTL    86400
; Authoritative data for demorgan.com.br
;
@      SOA  demorgan.com.br.  demorgan.demorgan.com.br. (
; the second name is domain master's email, in this case
; demorgan.demorgan.com.br. means demorgan@demorgan.com.br
                                2004102898      ; Serial (yymmddxx)
                                10800           ; Refresh 3 hours
                                3600            ; Retry   1 hour
                                36000           ; Expire  10 hours
                                86400 )         ; Minimum 24 hours
      NS       ns1.demorgan.com.br.
      NS       offsitedns.someotherdomain.com.br.
; the point of having two nameservers is redundancy, so there really
; is no point listing two and pointing them both to the same host.
      MX 10    mail.demorgan.com.br.
@     A        200.138.31.116
;only one A record for each host, then aliases (CNAMEs)
;for anything else that resolves to that host

www   CNAME    demorgan.com.br.
ns1   CNAME    demorgan.com.br.
mail  CNAME    demorgan.com.br.

Last edited by Darin; 02-09-2006 at 03:22 PM.
 
Old 02-09-2006, 03:14 PM   #7
stormrider_may
Member
 
Registered: Sep 2005
Distribution: Debian
Posts: 304

Original Poster
Rep: Reputation: 30
Quote:
Originally Posted by Darin
Code:
<VirtualHost www.demorgan.com.br>
   ServerName www.demorgan.com.br
   DocumentRoot "/var/www/demorgan"
</VirtualHost>
The paramater for the VirtualHost entry is what tells Apache that requests for this URL go to the specified directory, the ServerName entry is just what Apache reports back to the client, *after* it has fulfilled the request.
Still not working
 
Old 02-09-2006, 03:24 PM   #8
Darin
Senior Member
 
Registered: Jan 2003
Location: Portland, OR USA
Distribution: Slackware, SLAX, Gentoo, RH/Fedora
Posts: 1,024

Rep: Reputation: 45
Quote:
Originally Posted by stormrider_may
Still not working
Verify whether it's a problem in DNS or Apache. If both domain names resolve to the correct IP address, then the problem is in the Apache virtual host settings. Also, did you restart Apache after modifying the settings?
 
Old 02-09-2006, 03:29 PM   #9
stormrider_may
Member
 
Registered: Sep 2005
Distribution: Debian
Posts: 304

Original Poster
Rep: Reputation: 30
Yes, i restarted. On apache log i can see people getting on http://my_ip/ and not http://my_ip/demorgan

Code:
200.138.181.215 - - [09/Feb/2006:00:49:34 -0200] "GET / HTTP/1.0" 200 243
200.138.191.48 - - [09/Feb/2006:00:54:19 -0200] "GET / HTTP/1.0" 200 243
200.181.210.131 - - [09/Feb/2006:15:15:10 -0200] "GET / HTTP/1.1" 200 243
200.181.210.131 - - [09/Feb/2006:15:17:00 -0200] "GET / HTTP/1.1" 200 243
200.138.31.121 - - [09/Feb/2006:19:11:55 -0200] "GET / HTTP/1.1" 200 243
200.138.31.121 - - [09/Feb/2006:19:13:19 -0200] "GET / HTTP/1.1" 200 243
200.138.31.121 - - [09/Feb/2006:19:13:24 -0200] "GET / HTTP/1.1" 200 243
200.138.31.121 - - [09/Feb/2006:19:13:25 -0200] "GET / HTTP/1.1" 200 243
200.138.31.121 - - [09/Feb/2006:19:13:26 -0200] "GET / HTTP/1.1" 200 243
200.138.31.121 - - [09/Feb/2006:19:15:48 -0200] "GET / HTTP/1.1" 200 243
 
Old 02-09-2006, 04:47 PM   #10
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,175
Blog Entries: 1

Rep: Reputation: 2042Reputation: 2042Reputation: 2042Reputation: 2042Reputation: 2042Reputation: 2042Reputation: 2042Reputation: 2042Reputation: 2042Reputation: 2042Reputation: 2042
Quote:
<VirtualHost www.demorgan.com.br>
ServerName www.demorgan.com.br
DocumentRoot "/var/www/demorgan"
</VirtualHost>
That definition is wrong. You should use an IP address, or at least the * inside the <VirtualHost ..> for name based vhosts. The configuaration in your first post is OK, but use different directories as DocumentRoot for every server.

What about your email prob?
 
Old 02-09-2006, 05:04 PM   #11
stormrider_may
Member
 
Registered: Sep 2005
Distribution: Debian
Posts: 304

Original Poster
Rep: Reputation: 30
Quote:
Originally Posted by bathory
That definition is wrong. You should use an IP address, or at least the * inside the <VirtualHost ..> for name based vhosts. The configuaration in your first post is OK, but use different directories as DocumentRoot for every server.

What about your email prob?
But then i should have i CNAME in dns server, right? I think this is the problem.

using this config

Code:
$TTL    86400
; Authoritative data for demorgan.com.br
;
@                IN       SOA demorgan.com.br.  fernando.demorgan.com.br. (
                                2006020904      ; Serial (yymmddxx)
                                10800           ; Refresh 3 hours
                                3600            ; Retry   1 hour
                                36000           ; Expire  10 hours
                                86400 )         ; Minimum 24 hours
                 IN       NS            ns1.demorgan.com.br.
;                 IN       NS            ns2.demorgan.com.br.
IN MX       10            mail.demorgan.com.br.
@    A        200.138.31.116
www           IN       CNAME         demorgan.com.br.
ns1           IN       CNAME         demorgan.com.br.
I really don't know what i have to do
 
Old 02-09-2006, 05:19 PM   #12
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,175
Blog Entries: 1

Rep: Reputation: 2042Reputation: 2042Reputation: 2042Reputation: 2042Reputation: 2042Reputation: 2042Reputation: 2042Reputation: 2042Reputation: 2042Reputation: 2042Reputation: 2042
Quote:
IN MX 10 mail.demorgan.com.br.
In this config you haven't define mail.demorgan.com.br. Define as an A record (better) or CNAME:
Code:
mail           IN       A         200.138.31.116
and of cousre you must also define the reverse-zone file to be able to resolve 200.138.31.116 to mail.demorgan.com.br as it is a mail server. Create the reverse zone file using something like:
Code:
116.31.138.200-in-addr.arpa. IN PTR mail.demorgan.com.br.
or
16 IN PTR mail.demorgan.com.br.
and add also the entry for the reverse zone file in your /etc/named.conf
 
Old 02-09-2006, 05:28 PM   #13
stormrider_may
Member
 
Registered: Sep 2005
Distribution: Debian
Posts: 304

Original Poster
Rep: Reputation: 30
Quote:
Originally Posted by bathory
and of cousre you must also define the reverse-zone file to be able to resolve 200.138.31.116 to mail.demorgan.com.br as it is a mail server. Create the reverse zone file using something like:
Code:

116.31.138.200-in-addr.arpa. IN PTR mail.demorgan.com.br. or 16 IN PTR mail.demorgan.com.br.

and add also the entry for the reverse zone file in your /etc/named.conf
I really don't know how to do it. If you help me, i would appreciate.

About Virtual Host, they still now working. Should i define something like
Code:
www IN A 200.138.31.116
www IN CNAME demorgan.com.br.
Because just setting

www IN CNAME demorgan.com.br. doens't seen to work.
 
Old 02-09-2006, 05:49 PM   #14
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,175
Blog Entries: 1

Rep: Reputation: 2042Reputation: 2042Reputation: 2042Reputation: 2042Reputation: 2042Reputation: 2042Reputation: 2042Reputation: 2042Reputation: 2042Reputation: 2042Reputation: 2042
First things first.
Edit your /etc/named.conf and add an entry under your forward zone (the one for demorgan.com.br) like this:
Code:
zone "0.31.138.200.in-addr.arpa" {
        type master;
        file "0.31.138.200.in-addr.arpa";
};
I don't know what is your IP chunk so I put 0.31.138.200.in-addr.arpa which is valid if you have assigned a whole 200.138.31.0/255.255.255.0 network. If that's not true then change it accordingly replacing the "0" with your first assigned IP. Anyway you can contact your ISP for help.
Then edit your forward zone (don't forget to increase the serial):
Code:
$TTL    86400
; Authoritative data for demorgan.com.br
;
@                IN       SOA demorgan.com.br.  fernando.demorgan.com.br. (
                                2006020905      ; Serial (yymmddxx)
                                10800           ; Refresh 3 hours
                                3600            ; Retry   1 hour
                                36000           ; Expire  10 hours
                                86400 )         ; Minimum 24 hours
                 IN       NS            ns1.demorgan.com.br.
;                 IN       NS            ns2.demorgan.com.br.
IN MX       10            mail.demorgan.com.br.
demorgan.com.br.    A        200.138.31.116
www           IN       CNAME         demorgan.com.br.
ns1           IN       CNAME         demorgan.com.br.
mail          IN       CNAME         demorgan.com.br.
Then create the 0.31.138.200.in-addr.arpa file:
Code:
$TTL 86400
$ORIGIN 0.31.138.200.in-addr.arpa.
@      SOA     demorgan.com.br.  fernando.demorgan.com.br. (
                        2006020905      ; serial #
                                10800           ; Refresh 3 hours
                                3600            ; Retry   1 hour
                                36000           ; Expire  10 hours
                                86400 )         ; Minimum 24 hours
        IN      NS      ns1.demorgan.com.br.

116            PTR     mail.demorgan.com.br.
Restart bind and see if you can resolve hosts and IPs
Code:
nslookup www.demorgan.com.br
nslookup mail.demorgan.com.br
nslookup 200.138.31.116
I hope there is no typo in this and everything will work.
 
Old 02-09-2006, 06:16 PM   #15
stormrider_may
Member
 
Registered: Sep 2005
Distribution: Debian
Posts: 304

Original Poster
Rep: Reputation: 30
I think i'm on the right way, but bind keeps getting errors, look

Code:
Feb  9 22:18:08 localhost named[13774]: starting (/etc/bind/named.conf).  named 8.4.6-REL-NOESW Tue Jan 25 19:11:36 UTC 2005 ^Ilamont@mix:/build/lamont/bind-8.4.6/src/bin/named
Feb  9 22:18:08 localhost named[13774]: hint zone "" (IN) loaded (serial 0)
Feb  9 22:18:08 localhost named[13774]: master zone "localhost" (IN) loaded (serial 42)
Feb  9 22:18:08 localhost named[13774]: demorgan.com.br.domain: WARNING SOA expire value is less than refresh + 10 * retry (36000 < (10800 + 10 * 3600))
Feb  9 22:18:08 localhost named[13774]: demorgan.com.br.domain: WARNING SOA expire value is less than 7 days (36000)
Feb  9 22:18:08 localhost named[13774]: Zone "demorgan.com.br" (file demorgan.com.br.domain): no NS RRs found at zonetop
Feb  9 22:18:08 localhost named[13774]: zone: demorgan.com.br/IN: non-glue record at bottom of zone: IN.demorgan.com.br/MX
Feb  9 22:18:08 localhost named[13774]: master zone "demorgan.com.br" (IN) rejected due to errors (serial 2006020907)
Feb  9 22:18:08 localhost named[13774]: 116.31.138.200.in-addr.arpa: WARNING SOA expire value is less than refresh + 10 * retry (36000 < (10800 + 10 * 3600))
Feb  9 22:18:08 localhost named[13774]: 116.31.138.200.in-addr.arpa: WARNING SOA expire value is less than 7 days (36000)
Feb  9 22:18:08 localhost named[13774]: Zone "116.31.138.200.in-addr.arpa" (file 116.31.138.200.in-addr.arpa): no NS RRs found at zone top
Feb  9 22:18:08 localhost named[13774]: master zone "116.31.138.200.in-addr.arpa" (IN) rejected due to errors (serial2006020905)
Feb  9 22:18:08 localhost named[13774]: ctl_server: socket: Address family not supported by protocol
Feb  9 22:18:08 localhost named[13774]: listening on [127.0.0.1].53 (lo)
Feb  9 22:18:08 localhost named[13774]: listening on [192.168.0.1].53 (eth0)
Feb  9 22:18:09 localhost named[13774]: AF_INET6: address family not supported
Feb  9 22:18:09 localhost named[13774]: Forwarding source address is [0.0.0.0].34126
Feb  9 22:18:09 localhost named[13777]: Ready to answer queries.
Feb  9 22:18:09 localhost named[13777]: check_hints: A records for B.ROOT-SERVERS.NET class 1 do not match hint records
Feb  9 22:18:09 localhost named[13777]: check_hints: A records for J.ROOT-SERVERS.NET class 1 do not match hint records
bathory Thanks in advance for your help and patience!

Last edited by stormrider_may; 02-09-2006 at 06:18 PM.
 
  


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
Apache Virtual Host problem - DNS or DHCP issue? costrevs Linux - Software 16 03-23-2005 07:50 AM
mail server: just send mails out, but not receive hamish Linux - Software 4 02-27-2005 11:06 AM
How to configure the virtual host based name? gz_xmg Linux - Networking 0 12-28-2004 01:12 AM
RedHat 9 Virtual Hosting -- Configure DNS?? mlhammer Linux - Networking 6 09-24-2003 08:10 PM
mail server fail to send out and receive, help!! littlelittle Linux - Networking 7 03-14-2002 10:26 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 02:45 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
Open Source Consulting | Domain Registration