Apache default VirtualHost

前端 未结 9 1654
忘掉有多难
忘掉有多难 2020-12-05 17:53

how can I set a default VirtualHost in apache? Preferably, I want the default host not to be the same as the ip address host. Now I have something like this:



        
9条回答
  •  Happy的楠姐
    2020-12-05 17:58

    An alternative setting is to have the default virtual host at the end of the config file rather than the beginning. This way, all alternative virtual hosts will be checked before being matched by the default virtual host.

    Example:

    NameVirtualHost *:80
    Listen 80
    
    ...
    
    
            ServerName host1
            DocumentRoot /someDir
    
    
    
            ServerName host2
            DocumentRoot /someOtherDir
    
    
    
            DocumentRoot /defaultDir
    
    

提交回复
热议问题