apache 虚拟主机配置

apache 虚拟主机配置

1, 常见配置

##配置一个虚拟主机

   ServerAdmin fengjun
    ##指定主目录
    DocumentRoot "E:\\php"
    ErrorLog "logs/fengjun-error.log"
    CustomLog "logs/fengjun-access.log" combined
  

 

 

2,单独操作目录权限

 


    ServerAdmin fengjun
    DocumentRoot "E:\\php"
    ErrorLog "logs/fengjun-error.log"
    CustomLog "logs/fengjun-access.log" combined
    
     ##配置目录属性

     
    	Options Indexes FollowSymLinks Includes ExecCGI
    	AllowOverride All
    	Order allow,deny
    	Allow from all
    
 

 

 

3,主机头方式(一个主机同一个端口绑定多个域名)

 

##开启以域名访问方式 -- 不开启,会访问到第一个匹配的虚拟主机

NameVirtualHost *:80


    
    	Options Indexes FollowSymLinks Includes ExecCGI
    	AllowOverride All
    	Order allow,deny
    	Allow from all
    


    ServerAdmin fengjun
    DocumentRoot "E:\\php\\home"

    ##指定域名

    ServerName home.fengjun.com
    ErrorLog "logs/fengjun-error.log"
    CustomLog "logs/fengjun-access.log" combined



    ServerAdmin fengjun
    DocumentRoot "E:\\php\\study"
    
    ##指定域名

    ServerName study.fengjun.com
    ErrorLog "logs/fengjun-error.log"
    CustomLog "logs/fengjun-access.log" combined
 

 

 

 

 

你可能感兴趣的:(Apache,虚拟主机)