您的位置:首页 > 运维架构 > Apache

apache 虚拟主机配置

2016-06-11 14:39 387 查看
apache 虚拟主机配置


1, 常见配置
##配置一个虚拟主机
<VirtualHost *:80>
ServerAdmin fengjun
##指定主目录
DocumentRoot "E:\\php"
ErrorLog "logs/fengjun-error.log"
CustomLog "logs/fengjun-access.log" combined
</VirtualHost>

  
 
 

2,单独操作目录权限

 

<VirtualHost *:80>
ServerAdmin fengjun
DocumentRoot "E:\\php"
ErrorLog "logs/fengjun-error.log"
CustomLog "logs/fengjun-access.log" combined

##配置目录属性

<Directory "E:\\php">
Options Indexes FollowSymLinks Includes ExecCGI
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>

 
 

 

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

 

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

NameVirtualHost *:80

<Directory "E:\\php">
Options Indexes FollowSymLinks Includes ExecCGI
AllowOverride All
Order allow,deny
Allow from all
</Directory>

<VirtualHost *:80>
ServerAdmin fengjun
DocumentRoot "E:\\php\\home"

##指定域名

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

<VirtualHost *:80>
ServerAdmin fengjun
DocumentRoot "E:\\php\\study"

##指定域名

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

 
 

 

 

 
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: