Why my DNS resolution doesn't work on VirtualHost ?

Problems with the Linux version of XAMPP, questions, comments, and anything related.

Why my DNS resolution doesn't work on VirtualHost ?

Postby cleroy61 » 30. June 2011 11:46

Hi everybody,

I haven't got my dns resolution with the virtual host ? I think I forgot something, don't I ?

error message :

# nslookup http://www.discoverdigitalmarketingtips.com
Code: Select all
Server:         95.130.12.1
Address:        95.130.12.1#53

** server can't find www.discoverdigitalmarketingtips.com: NXDOMAIN



I rent a dedicated server, i configured domain name like this :

Code: Select all
Zones (Domaines) takinium.com.
   MX   mail   10   [Supprimer]

   NS   ns1.digicube.fr.      

   NS   ns2.digicube.fr.      

www   A   95.130.12.68      [Supprimer]

www   CNAME   discoverdigitalmarketingtips.com      [Supprimer]

www   CNAME   takinium.com.      [Supprimer]


I bought a domain name to Gandi, http://www.takinium.com, and I configured dns zone like this :

Code: Select all
ftp 28800 IN A 95.130.12.68
www 3600 IN A 95.130.12.68
@ 3600 IN A 95.130.12.68


I installed Famp, oscommerce, phpMyAdmin, wordpress, awstats in /usr/local/www folder with symbolic link to /usr/local/www/apache22/data :

http://www.takinium.com/wordpress/
http://www.takinium.com/phpMyadmin/

etc ...

I want putting another domain name on the same dedicated server, so I bought another domain name http://www.discoverdigitalmarketingtips.com to Gandi and and I configured the same dns zone like this :

Code: Select all
ftp 28800 IN A 95.130.12.68
www 3600 IN A 95.130.12.68
@ 3600 IN A 95.130.12.68


1 - I added in this file :
#ee /etc/rc.conf

Code: Select all
ifconfig_re0_alias0="192.168.1.10 netmask 255.255.255.255"


2 - I added in this file :
#ee /usr/local/etc/apache22/httpd.conf

Code: Select all
Listen 8080
Listen 192.168.1.10:8080

ServerName www.takinium.com:80
ServerName www.discoverdigitalmarketingtips.com:8080

# Virtual hosts
Include etc/apache22/extra/httpd-vhosts.conf


3 - I added in this file :
#ee /etc/hosts

Code: Select all
127.0.0.1               www.takinium.com        takinium.com
127.0.0.1               www.discoverdigitalmarketingtips.com    discoverdigitalmarketingtips.com


4 - I added in this file :
#ee /usr/local/etc/apache22/Includes/discoverdigitalmarketingtips.com.conf

Code: Select all
ServerName www.discoverdigitalmarketingtips.com

NameVirtualHost 192.168.1.10:8080

# Name VirtualHost 192.168.1.10:8080
<VirtualHost 192.168.1.10:8080>
ServerAdmin webmaster@discoverdigitalmarketingtips.com
   DocumentRoot /usr/local/www/discoverdigitalmarketingtips/
   ServerName www.discoverdigitalmarketingtips.com
   ServerAlias discoverdigitalmarketingtips.com *.discoverdigitalmarketingtips.com
   ErrorLog /var/log/http/discoverdigitalmarketingtips.com-error_log
   CustomLog /var/log/http/discoverdigitalmarketingtips.com-access_log combined
</VirtualHost>

5 - I created a folder et index.html

#mkdir /usr/local/www/discoverdigitalmarketingtips
#cp /tmp/index.html /usr/local/www/discoverdigitalmarketingtips/


#/usr/local/etc/rc.d/apache22 start
Syntax Ok
starting apache22
#httpd -S
Code: Select all
VirtualHost configuration:
192.168.1.10:8080      is a NameVirtualHost
         default server www.discoverdigitalmarketingtips.com (/usr/local/etc/apache22/Includes/discoverdigitalmarketingtips.com.conf:7)
         port 8080 namevhost www.discoverdigitalmarketingtips.com (/usr/local/etc/apache22/Includes/discoverdigitalmarketingtips.com.conf:7)
wildcard NameVirtualHosts and _default_ servers:
_default_:443          www.takinium.com/ (/usr/local/etc/apache22/extra/httpd-ssl.conf:74)
Syntax OK



# sockstat -4 | grep 192.168.1.10
Code: Select all
www      httpd      1686  6  tcp4   192.168.1.10:8080     *:*
www      httpd      1686  7  tcp4   192.168.1.10:443      *:*
www      httpd      1685  6  tcp4   192.168.1.10:8080     *:*
www      httpd      1685  7  tcp4   192.168.1.10:443      *:*
www      httpd      1684  6  tcp4   192.168.1.10:8080     *:*
www      httpd      1684  7  tcp4   192.168.1.10:443      *:*
www      httpd      1683  6  tcp4   192.168.1.10:8080     *:*
www      httpd      1683  7  tcp4   192.168.1.10:443      *:*
www      httpd      1682  6  tcp4   192.168.1.10:8080     *:*
www      httpd      1682  7  tcp4   192.168.1.10:443      *:*
root     httpd      1681  6  tcp4   192.168.1.10:8080     *:*
root     httpd      1681  7  tcp4   192.168.1.10:443      *:*


#dig +short NS takinium.com
Code: Select all
a.dns.gandi.net.
b.dns.gandi.net.
c.dns.gandi.net.


# ping discoverdigitalmarketingtips.com
Code: Select all
PING www.discoverdigitalmarketingtips.com (192.168.1.10): 56 data bytes
64 bytes from 192.168.1.10: icmp_seq=0 ttl=64 time=0.073 ms
64 bytes from 192.168.1.10: icmp_seq=1 ttl=64 time=0.054 ms


error message :

# nslookup http://www.discoverdigitalmarketingtips.com
Code: Select all
Server:         95.130.12.1
Address:        95.130.12.1#53

** server can't find www.discoverdigitalmarketingtips.com: NXDOMAIN


With the IP address (192.168.1.10), it's the same error message

# host http://www.discoverdigitalmarketingtips.com
Code: Select all
Host www.discoverdigitalmarketingtips.com not found: 3(NXDOMAIN)


Can you help, please ?
What did I forget ?

Thanks,

Christophe
cleroy61
 
Posts: 8
Joined: 28. July 2010 09:01

Re: Why my DNS resolution doesn't work on VirtualHost ?

Postby JonB » 04. July 2011 01:20

DId you create a virtual host for the default server?
User avatar
JonB
AF Moderator
 
Posts: 3210
Joined: 12. April 2010 16:41
Location: Land of the Blazing Sun
Operating System: Windows XP/7 - Fedora 15 1.7.7

Re: Why my DNS resolution doesn't work on VirtualHost ?

Postby cleroy61 » 04. July 2011 10:25

No, I do not know what it is! I wanted to add multiple site, so mutiple virtualHost on one server

1 - Should I create the file ee /usr/local/etc/apache22/httpd.conf or the other file /usr/local/etc/apache22/Includes/learndigitalmarketingtips.com.conf ?

2 - What Should I put in this file ?

something like that or other ?
Code: Select all
<VirtualHost _default_:*>
   DocumentRoot /usr/local/www/
   DirectoryIndex index.html
   Order Allow,Deny
   Allow from All
</VirtualHost>


3 - Do I need to create a default directory in / usr/local/www ?

Thanks a lot ; Have a nice day

Christophe
cleroy61
 
Posts: 8
Joined: 28. July 2010 09:01

Re: Why my DNS resolution doesn't work on VirtualHost ?

Postby cleroy61 » 04. July 2011 12:24

I wrote this code below in both :

Code: Select all
#ee /usr/local/etc/apache22/httpd.conf
#ee /usr/local/etc/apache22/Includes/learndigitalmarketingtips.com.conf

Code: Select all

<VirtualHost _default_:*>
   DocumentRoot /usr/local/www/ 
</VirtualHost>


with the same error access in the browser : http://www.takinium.com and http://www.learndigitalmarketingtips.com

Code: Select all
Forbidden

You don't have permission to access /index.html on this server.


I don't understand !!
cleroy61
 
Posts: 8
Joined: 28. July 2010 09:01

Re: Why my DNS resolution doesn't work on VirtualHost ?

Postby cleroy61 » 04. July 2011 12:38

I made a mistake that I corrected but I still have no access to http://www.learndigitalmarketingtips.com

It's good for this :
Code: Select all
host www.learndigitalmarketingtips.com
www.learndigitalmarketingtips.com has address 95.130.12.68


When I write the url in the browser, I've got the same result :
http://www.takinium.com and http://www.learndigitalmarketingtips.com

Code: Select all
It's works
http://www.takinium.com


For the second, I want display with a single index.html ;

Code: Select all
It's works
http://www.learndigitalmarketingtips.com

My DirectoryIndex is configured

The Domain name http://www.learndigitalmarketingtips.com display this :
Code: Select all
It's works
http://www.takinium.com
cleroy61
 
Posts: 8
Joined: 28. July 2010 09:01

Re: Why my DNS resolution doesn't work on VirtualHost ?

Postby JonB » 05. July 2011 02:07

learndigitalmarketingtips.com.conf

Did you add that with an 'Include' Directive right at the end of httpd.conf???

Did you make a separate folder for your Document Roots of your virtual hosts???

I do something like this:

/sites
/sites/site-1
/sites/site-2

Most folks I know put all their vhost configurations in one .conf, so its very clear what is going on. LOL, you know something original like lampp-vhosts.conf... Whatever, its just a thoguht

:?: Is that site name coming from text embedded in the index.html???

UNFORTUNATELY - both my OpenSUSE and Fedora servers took a dive about a month ago, so I am not in a position to experiment. :(

Both fried... (they were not brand new machines either) But still have to be replaced. :cry:

Good Luck
8)
User avatar
JonB
AF Moderator
 
Posts: 3210
Joined: 12. April 2010 16:41
Location: Land of the Blazing Sun
Operating System: Windows XP/7 - Fedora 15 1.7.7

Re: Why my DNS resolution doesn't work on VirtualHost ?

Postby cleroy61 » 07. July 2011 21:32

Hi everybody,

Quick Description

The two lines below display the content of their index.html
#telnet localhost 80
<html><body><h1>It works!</h1><h2>http://www.takinium.com </h2><b>AVEC VirtualHost</b></body></html>
#telnet localhost 81
<html><body><h1>It works!</h1><h2>www.learndigitalmarketingtips.com</h2>avec VirtualHost</body></html>

When I ask in the browser, http://www.learndigitalmarketingtips.com, it display the content of index.html file of http://www.takinium.com, that is to say, It Works, http://www.takinium.com AVEC VirtualHost ; in others terms, Virtual host http://www.learndigitalmarketingtips.com doesn't work

END - Quick Description

I rent a dedicated server to digicube where I installed FreeBSD8, apache22 mysql et PHP5

I need and want installing two, and multiples domains on this server.

my IP address is 95.130.12.68 ; The domain names I bought to Gandi call : http://www.takinium.com et http://www.learndigitalmarketingtips.com

apache directory on freebsd is in /usr/local/www/apache22/data/ folder
I put my 2 virtualHost folder in /usr/local/www, like this /usr/local/www/takinium/ and /usr/local/www/learndigitalmarketingtips/

I configured dns zones on my digicube :

Code: Select all
Zones (Domaines) takinium.com.
    MX    mail    10    [Supprimer]

    NS    ns1.digicube.fr.       

    NS    ns2.digicube.fr.       

www    A    95.130.12.68        [Supprimer]

www    CNAME    learndigitalmarketingtips.com        [Supprimer]

www    CNAME    takinium.com.        [Supprimer]


On Gandi, I configured dns zone :

Code: Select all
ftp 28800 IN A 95.130.12.68
www 3600 IN A 95.130.12.68
@ 3600 IN A 95.130.12.68


I configured index.html file in each folder to recognize them and .conf file for the 2 domains :
1 - for takinium.com :
#ee /usr/local/www/takinium/index.html
Code: Select all
It Works!
www.takinium.com
avec VirtualHost

#ee /usr/local/etc/apache22/Includes/takinium.com.conf
Code: Select all
NameVirtualHost *:80
<VirtualHost *:80>
        ServerAdmin webmaster@takinium.com
        DocumentRoot /usr/local/www/takinium/
        ServerName www.takinium.com
        ServerAlias talinium.com *.takinium.com
                <Directory /usr/local/www/takinium/>
                        Options Indexes FollowSymLinks MultiViews
                        DirectoryIndex index.html index.htm index.php index.php5
                        AllowOverride All
                        Order allow,deny
                        allow from all
                </Directory>
        ErrorLog /var/log/http/takinium.com-error_log
        CustomLog /var/log/http/takinium.com-access_log combined


2 - for leanrdigitalmarketingtips.com
#ee /usr/local/www/learndigitalmarketingtips/index.html
Code: Select all
It Works!
www.learndigitalmarketingtips.com
avec VirtualHost

#ee /usr/local/etc/apache22/Includes/learndigitalmarketingtips.com.conf

Code: Select all
NameVirtualHost *:81
<VirtualHost *:81>
        ServerAdmin webmaster@learndigitalmarketingtips.com
        DocumentRoot /usr/local/www/learndigitalmarketingtips/
        DirectoryIndex index.html index.htm index.php
        ServerName www.learndigitalmarketingtips.com
        ServerAlias learndigitalmarketingtips.com *.learndigitalmarketingtips.com
                <Directory /usr/local/www/learndigitalmarketingtips/>
                        Options Indexes FollowSymLinks MultiViews
                        DirectoryIndex index.html index.htm index.php index.php5
                        AllowOverride All
                        Order allow,deny
                        allow from all
                </Directory>
        ErrorLog /var/log/http/learndigitalmarketingtips.com-error_log
        CustomLog /var/log/http/learndigitalmarketingtips.com-access_log combined


Both lines below display the index.html content
#telnet localhost 80
<html><body><h1>It works!</h1><h2>http://www.takinium.com </h2><b>AVEC VirtualHost</b></body></html>
#telnet localhost 81
<html><body><h1>It works!</h1><h2>www.learndigitalmarketingtips.com</h2>avec VirtualHost</body></html>


by cons, when I ask by the browser http://www.learndigitalmarketingtips.com, it display http://www.takinium.com, that is to say, It Works, http://www.takinium.com AVEC VirtualHost ; In others terms, Virtual host doen't work although the following command says otherwise:

#httpd -S
Code: Select all
VirtualHost configuration:
wildcard NameVirtualHosts and _default_ servers:
*:80                   is a NameVirtualHost
         default server www.takinium.com (/usr/local/etc/apache22/Includes/takinium.com.conf:4)
         port 80 namevhost www.takinium.com (/usr/local/etc/apache22/Includes/takinium.com.conf:4)
*:81                   is a NameVirtualHost
         default server www.learndigitalmarketingtips.com (/usr/local/etc/apache22/Includes/learndigitalmarketingtips.com.conf:3)
         port 81 namevhost www.learndigitalmarketingtips.com (/usr/local/etc/apache22/Includes/learndigitalmarketingtips.com.conf:3)
Syntax OK


1 - I need some helps to run 2nd VirtualHost http://www.learndigitalmarketingtips.com ?
2 - priority question and/or default config for the first vhost ?
3 - Do I add domain in /etc/hosts ?

Thanks a lot and have a nice day/evening

regards
Christophe
cleroy61
 
Posts: 8
Joined: 28. July 2010 09:01

Re: Why my DNS resolution doesn't work on VirtualHost ?

Postby cleroy61 » 08. July 2011 07:54

the position of 81 was voluntary ; I thought to separate ; and when I had position on 80, I always restart Apache with an error message appears on the command line:

#/usr/local/etc/rc.d/apache22 restart

Code: Select all
Performing sanity check on apache22 configuration:
[Thu Jul 07 20:40:08 2011] [warn] NameVirtualHost *:80 has no VirtualHosts
Syntax OK
Stopping apache22.
Waiting for PIDS: 2448.
Performing sanity check on apache22 configuration:
[Thu Jul 07 20:40:08 2011] [warn] NameVirtualHost *:80 has no VirtualHosts
Syntax OK
Starting apache22.
[Thu Jul 07 20:40:09 2011] [warn] NameVirtualHost *:80 has no VirtualHosts


Although the two domains each display their index.html in the browser, the error messages puzzle me?

Do you have an idea? I found at the same time when I was writing!

I deleted the line NameVirtualHost *: 80 and the error message no longer appears and it works

#ee /usr/local/etc/apache22/Includes/takinium.com.conf

Code: Select all
NameVirtualHost *:80


but I tried to add a different IP to a different port on two different domains, this method does not work and / or I do not understand it even with the Apache documentation in French.

I thank you & have a nice day/evening

Regards

Christophe
cleroy61
 
Posts: 8
Joined: 28. July 2010 09:01

Re: Why my DNS resolution doesn't work on VirtualHost ?

Postby JonB » 08. July 2011 08:12

Crristophe -

While we try to be helpful. all of us are volunteers (many with IT careers) and so, are pretty busy.

THUS - we are mainly focused on supporting XAMPP as a package, and making XAMPP configurations work.

The questions you have just posed really belong on an Apache/Linux forum, not here.

Good Luck with your project.
8)
User avatar
JonB
AF Moderator
 
Posts: 3210
Joined: 12. April 2010 16:41
Location: Land of the Blazing Sun
Operating System: Windows XP/7 - Fedora 15 1.7.7

Re: Why my DNS resolution doesn't work on VirtualHost ?

Postby cleroy61 » 08. July 2011 12:23

Thanks for your answer !

I did not notice it was a Xampp part ; as it's a german forum, I put this message in the english part !

Don't worry, I got the answer, and It works for both domains, but I do not understand adding multiple IP and multiple ports

Thanks for helping me
cleroy61
 
Posts: 8
Joined: 28. July 2010 09:01

Re: Why my DNS resolution doesn't work on VirtualHost ?

Postby WilliL » 08. July 2011 13:58

cleroy61 wrote:but I do not understand adding multiple IP and multiple ports

have a look here: http://httpd.apache.org/docs/2.0/en/vhosts/
Willi
WilliL
 
Posts: 661
Joined: 08. January 2010 10:54
Operating System: Win7Home Prem 64 SP1


Return to XAMPP for Linux

Who is online

Users browsing this forum: No registered users and 8 guests