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

apache下虚拟主机的配置

2013-12-18 20:28 357 查看
 1. 启用httpd-vhosts.conf
      在httpd.confg文件中找到
      # Virtual hosts
      #Include conf/extra/httpd-vhosts.conf(这里将前面的#去掉即可启用虚拟主机)
     ! 如果是使用套件AppServ之类的还需要启用mod_vhost_alias.so模块(#LoadModule vhost_alias_module modules/mod_vhost_alias.so)
  2. 配置httpd-vhosts.conf       
<VirtualHost *:80>    #配置网站站点根目录(例如:d:/mywebsite)   DocumentRoot "d:/mywebsite"    #配置网站域名   ServerName www.website.com   #下面配置网站根目录的相关属性('/' <=> 'd:/mywebsite' )
   <Directory />        #配置在没有指定网站首页面时,是否显示目录结构列表
        Options index FollowSymLinks        #配置修改权限(None 表示不允许)
        AllowOverride None        #设置访问权限        Order allow,deny        Allow from all
        #配置网站的首页面
        DiectoryIndex index.html index.htm index.php
        #配置网站404错误页面
        errorDocument 404 /404.html
   </Directory></VirtualHost>
  ②httpd.confg文件中找到如下内容

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