-1

I have two identical VH in httpd/conf.d/.

//test.conf
<VirtualHost *:80>
   ServerName testadmin.mysite.it
   DocumentRoot /var/www/html/testadmin
</VirtualHost>


//release.conf
<VirtualHost *:80>
   ServerName deploy.mysite.it
   DocumentRoot /var/www/html/release
</VirtualHost>



httpd -S|grep release
         port 80 namevhost release.mysite.it (/var/www/mysite/deploy.conf:1)

But a ping on test.mysite.it works, a ping on deploy.mysite.it does not. I know ping is not the best tool to check. Both subdomains are handled by the same webserver, as you can see from the VH. But testadmin.mysite.it is reachable in the browser (it is resolved), the other is not.

Sure, if I put in my /etc/hosts the mapping

<ip of webserver> release.mysite.it 

it works.

My question is: if I had not to set up the host for the first site, why I have to do it for the second?

There is something I can use to check for this problem?

Both files are included in http.conf.

gdm
  • 459
  • 2
  • 5
  • 19
  • 3
    ping has nothing to do with VirtualHosts. You need to have IPs assigned to the computer running apache, and you need your computers to resolve the names into IPs correctly. That is the prerequisite. Then you are ready to setup VirtualHosts. – nobody Apr 04 '19 at 11:04
  • 2
    Get your story straight. For starters, show exactly what you try and how that fails. What is the error message you get when you do `ping deploy.mysite.it`? – Sven Apr 04 '19 at 13:28

1 Answers1

3

Apache has nothing to do with a ping. You need to make sure both host names are resolvable in DNS and point to the same machine (e.g. the same IP address).

Sven
  • 98,649
  • 14
  • 180
  • 226
  • The address is the same. Both VH are on the same webserve. See the edit of the of question. – gdm Apr 04 '19 at 13:20
  • @giuseppe Your question mentions *only* the webserver config. It does not mention the DNS config. Also you don't say what the error message is that you're getting when you try to ping the site. – Jenny D Apr 05 '19 at 06:49