Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I just set up LAMP on a new CentOS server. Previously when I installed LAMP on Ubuntu, I always needed to create a virtual host definition for each website I create in my /var/www directory.

But on CentOS, I realised once I put my website into my /var/www directory, it's immediately visible on my browser.

I included this directive: Include conf/vhosts/*.conf in my httpd.conf file in order to define virtual hosts for specific sites. Inside my vhost directory, I have defined my *.conf files.

Can anyone tell me what needs to be edited, possibly in httpd.conf, to stop sites that don't have an individual /vhosts/*.conf file from displaying when visited?

Below is my default virtual host definition information which I amend for each new site:

<VirtualHost var/www/aSite:80>
    ServerAdmin webmaster@dummy-host.example.com
    DocumentRoot var/www/aSite
    ServerName myServer
    ErrorLog var/www/aSite/logs/error_log
    CustomLog var/www/aSite/logs/access_log common
</VirtualHost>
share|improve this question
1  
You know that <VirtualHost var/www/aSite:80> doesn't make any sense, right? The argument before the port number (:80) is supposed to be a hostname or ip address (or *). –  larsks Mar 30 '12 at 1:10
    
:-) yes! I just put aSite in there as a place holder –  sisko Apr 3 '12 at 9:12

1 Answer 1

I'll tell from my mind and memory (can't verify on CentOS), you have somewhere in httpd.conf

This module creates dynamically configured virtual hosts, by allowing the IP address and/or the Host: header of the HTTP request to be used as part of the pathname to determine what files to serve. This allows for easy use of a huge number of virtual hosts with similar configurations.

  • VirtualDocumentRoot defined into /var/www/(something) + possible VirtualScriptAlias

PS: Can you tell me, why you want to stop this (nice, from my POV) behavior?

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.