Configuring Virtual Hosts in Apache

2

I'm trying to create a virtualhost here in the company, but it does not work. The funny thing is that I created the same way of other virtualhosts that are working normally.

Follow the example below:

VirtualHost 1

<VirtualHost *>
    ServerName manobra.henriquestefani.com.br
DocumentRoot "C:/Program Files/Apache Software Foundation/Apache2.2/htdocs/bpm/intranet"
</VirtualHost>

VirtualHost 2

<VirtualHost *>
    ServerName retornoviagem.henriquestefani.com.br
DocumentRoot "C:/Program Files/Apache Software Foundation/Apache2.2/htdocs/retornoviagem"
</VirtualHost>

The virtualhost1 works normally, whereas the virtualhost2 does not.

    
asked by anonymous 14.02.2014 / 18:31

2 answers

2

In the apache 2.2 documentation, available at link , you have the following example.

NameVirtualHost *:80

 <VirtualHost *:80>
ServerName www.domain.tld
 DocumentRoot /www/domain
 </VirtualHost>

 <VirtualHost *:80>
ServerName www.otherdomain.tld
 DocumentRoot /www/otherdomain
 </VirtualHost>

Apparently, from the documentation, the NameVirtualHost directive is required, but I did not see it in your example.

When Apache receives a request pointing to an unknown domain, it is directed to the first VirtualHosts of the configuration. So, since your VirtualHosts2 does not even open the page, it might be that the domain is not pointing to the correct IP, either.

    
15.02.2014 / 20:45
0

You need to restart Apache after changing the settings for them to take effect.

    
15.02.2014 / 00:27