Subdomain does not work with www

I am dealing with a very strange problem while trying to set up a new subdomain in a virtual machine.

The problem is simple:

I have two virtual host entries in my httpd-vhosts.conf pointing to the same path. Both should have the same behavior as in the same configuration as shown below:


#
# FIRST ENTRY #######################
#
<VirtualHost www.jorgevalhondo.com:80>
    ServerAdmin you@localhost.com
    DocumentRoot /opt/lampp/htdocs/trabsi
    ServerName www.development.trabsi.com
    ServerAlias www.development.trabsi.com
    ErrorLog logs/jorgevalhondo-error_log
    CustomLog logs/jorgevalhondo-access_log common
</VirtualHost>


#
#SECOND ENTRY ####################
#
<VirtualHost www.development.trabsi.com:80 development.trabsi.com:80>
    ServerAdmin info@trabsi.com
    DocumentRoot /opt/lampp/htdocs/trabsi
    ServerName www.jorgevalhondo.com
    ErrorLog logs/trabsi-error_log
    CustomLog logs/trabsi-access_log common
</VirtualHost>

      


Everything works well with the first entry:


With the second:

but

You do not have permission to access this server / on this server. In addition, a 404 Not Found error was encountered while trying to use the ErrorDocument to process the request.

Any ideas on what might be wrong here and how to solve it? Feel free to follow the links provided to check the issue live.

Thank.

+3


source to share


3 answers


This is a DNS problem, check the details:

nmap -p 80 www.development.trabsi.com

      

Return:

Starting Nmap 6.40 ( http://nmap.org ) at 2015-06-01 04:58 JST
Nmap scan report for www.development.trabsi.com (217.160.186.97)
Host is up (0.28s latency).
rDNS record for 217.160.186.97: clienteservidor.es
PORT   STATE SERVICE
80/tcp open  http

Nmap done: 1 IP address (1 host up) scanned in 0.85 seconds

      



Then the same command for development.trabsi.com should point to the same IP, but it doesn't:

nmap -p 80 development.trabsi.com

Starting Nmap 6.40 ( http://nmap.org ) at 2015-06-01 04:59 JST
Nmap scan report for development.trabsi.com (217.160.132.248)
Host is up (0.27s latency).
PORT   STATE SERVICE
80/tcp open  http

Nmap done: 1 IP address (1 host up) scanned in 0.85 seconds

      

Finally, if you run the same command for www.jorgevalhondo.com and jorgevalhondo.com , you will see that they point to the 217.160.132.248 IP you get for development.trabsi.com , but not the same for www.development. trabsi.com ( 217.160.186.97 )

Hence, this is just a DNS issue, check with your DNS provider.

+1


source


These VHosts have different IP addresses but the same servername. In this case, the corresponding VHost should come first, but you are referring to it with a different IP address. This results in a mismatch error. You must rename the first VHost.



0


source


not a DNS issue, but the vHost config:

example for the first:

<VirtualHost *:80>

   ServerName jorgevalhondo.com
   ServerAlias www.jorgevalhondo.com
   # ServerAlias *.jorgevalhondo.com

   # custom config ...

</VirtualHost>

      

example for the second:

<VirtualHost *:80>

   ServerName development.trabsi.com
   ServerAlias www.development.trabsi.com
   # ServerAlias *.development.trabsi.com

   # custom config ...

</VirtualHost>

      

ServerAlias ​​also supports wildcards - in case you want to match any.

0


source







All Articles