LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Server (http://www.linuxquestions.org/questions/linux-server-73/)
-   -   CentOS 6.2 - subdomain doesn't work and problems with making VirtualHost (http://www.linuxquestions.org/questions/linux-server-73/centos-6-2-subdomain-doesnt-work-and-problems-with-making-virtualhost-938069/)

Gruszka1 04-04-2012 08:24 AM

CentOS 6.2 - subdomain doesn't work and problems with making VirtualHost
 
I've got some serious problems with my vServer. I've been working on that for over 3 days with no results. I'm working on CentOS 6.2 (LAMP). The problem is that subdomains doesn't work for me. I'm using bind9 as a DNS service and my server is supposed to be my master DNS. As a slave server I use a free service at 42.pl website. When I ping my domain grucha.eu it returns correct ip address but subdomains doesn't work. Also www.grucha.eu doesn't. Does anyone has any solution for that? Here is my domain zone configuration:

Code:

$TTL 3600 ;  Default TTL
grucha.eu.      IN SOA  fns1.42.pl. vps.grucha.eu (
                        2012040411 ; serial number
                        3600      ; (refresh)
                        900        ; (retry)
                        360000    ; (expire)
                        3600      ;  TTL
)

$ORIGIN grucha.eu
                IN MX 0 mail.grucha.eu.
                IN NS  fns1.42.pl.
                IN NS  fns2.42.pl.
grucha.eu.      IN A    78.47.154.246
www            IN CNAME grucha.eu.
vps            IN CNAME grucha.eu.
mail            IN CNAME grucha.eu.
subdomena      IN CNAME grucha.eu.

Webhosting company which provides me domain has a panel where I can configure DNS1 and DNS2. I directed both dns1 and dns2 into fns1.42.pl and fns2.42.pl. And at that website (42.pl) I configured an IP address which their dns server should point to. That's the only thing I can set up in there.

bathory 04-05-2012 11:54 AM

Hi,
Quote:

When I ping my domain grucha.eu it returns correct ip address but subdomains doesn't work. Also www.grucha.eu doesn't.
I guess you've already fixed it, as it works from here:
Code:

nslookup www.grucha.eu
Server:        127.0.0.1
Address:        127.0.0.1#53

Non-authoritative answer:
www.grucha.eu  canonical name = grucha.eu.
Name:  grucha.eu
Address: 78.47.154.246

If this is not what you expect, please clarify

Regards

lithos 04-05-2012 12:33 PM

What I have is the zone defined like:
Code:

$ORIGIN .
$TTL 86400      ; 1 day
example.com          IN SOA  ns.example.com. info.example.com. (
                                2011111111 ; serial
                                7200      ; refresh (2 hours)
                                3600      ; retry (1 hour)
                                604800    ; expire (1 week)
                                86400      ; minimum (1 day)
                                )
                        NS      ns.example.com.
                        NS      ns.example.net.

                        A      1.2.3.3

                        MX      10 mail.example.com.
mail                    A      1.2.3.4
ns                      A      1.2.3.3
subdomain                  A      1.2.3.4

service                A      1.2.3.5
www                    A      1.2.3.3

try get rid of CNAMEs.

good luck

Gruszka1 04-05-2012 04:01 PM

Yeah, it works now. The reason why it didn't work was that my main domain was doubled because of one line and my DNS server was interpreting that as subdomain.grucha.eu.grucha.eu...

it works fine right now and it looks like that:

Code:

$TTL 3600 ;  Default TTL
grucha.eu.      IN SOA  fns1.42.pl. vps.grucha.eu (
                        2012040411 ; serial number
                        3600      ; (refresh)
                        900        ; (retry)
                        360000    ; (expire)
                        3600      ;  TTL
)

$ORIGIN grucha.eu.
                IN MX 0 mail.grucha.eu.
                IN NS  fns1.42.pl.
                IN NS  fns2.42.pl.
                IN A    78.47.154.246
www            IN CNAME grucha.eu.
vps            IN CNAME grucha.eu.
mail            IN CNAME grucha.eu.
subdomena      IN CNAME grucha.eu.

As you can see I fixed two things. First was changing
Code:

grucha.eu. IN A 78.47.154.246
for
Code:

IN A 78.47.154.246
and the second one was missing dot after grucha.eu in line:
Code:

$ORIGIN grucha.eu
Thanks everyone for help!

I've got another question about fstab. I would like to mount automatically /dev ; devpts, /proc and tmpfs into my chroot directory but I don't know how to do that. Whenever I reboot my machine, I have to mount them manually. Anyone has any solution for that? For example I want to automount from fstab /dev into /lala/la2/chroot. I know how to do that manually from the command prompt but I don't understand how should it look like by using fstab. Also I would like to automount from my fstab vsftpd users into virtualhosts. My vsftpd users are in /home/user_name/ but my virtualhosts are (let's say) in /somecatalog/something/sudbomain.domain.com. My friend told me that it's a safer way than making symlinks into that folders. Anyone got any clue?Oh and that /home/user_name/ and also /somecatalog/something/subdomain.domain.com are both located inside the chroot environment /lala/la2/chroot so for example virtualhost is inside: /lala/la2/chroot/somecatalog/something/subdomain.domain.com

bathory 04-07-2012 03:28 AM

Quote:

I've got another question about fstab. I would like to mount automatically /dev ; devpts, /proc and tmpfs into my chroot directory but I don't know how to do that. Whenever I reboot my machine, I have to mount them manually. Anyone has any solution for that? For example I want to automount from fstab /dev into /lala/la2/chroot. I know how to do that manually from the command prompt but I don't understand how should it look like by using fstab. Also I would like to automount from my fstab vsftpd users into virtualhosts. My vsftpd users are in /home/user_name/ but my virtualhosts are (let's say) in /somecatalog/something/sudbomain.domain.com. My friend told me that it's a safer way than making symlinks into that folders. Anyone got any clue?Oh and that /home/user_name/ and also /somecatalog/something/subdomain.domain.com are both located inside the chroot environment /lala/la2/chroot so for example virtualhost is inside: /lala/la2/chroot/somecatalog/something/subdomain.domain.com
Better start a new thread about this issue.
I don't know if you can use automount to do what you want, but if I were you, I'd put the commands you use to mount those pseudofilesystems in /etc/rc.local, so they'll execute on boot after everything else is up and running

Regards

Gruszka1 04-07-2012 08:50 AM

Ok, thanks. I will make a new thread and also test that method with executing on boot.


All times are GMT -5. The time now is 11:50 PM.