一聚教程网:一个值得你收藏的教程网站

热门教程

Apache如何配置多个虚拟主机

时间:2022-06-25 00:21:43 编辑:袖梨 来源:一聚教程网

VirtualHost

在我的本机内 Apache 的主配置文件在:

 代码如下 复制代码

D:/usr/local/apache2/conf/httpd.conf

创建各个虚拟主机的子配置文件:

创建 dbmanager 的配置文件:D:/usr/webroot/phpMyAdmin/httpd.conf

 代码如下 复制代码

#dbmanager 虚拟主机设置

    ServerName www.111com.net
    DocumentRoot D:/usr/webroot/phpMyAdmin
  
    
        AllowOverride All
        Options All
    

创建 phpweb20 的配置文件:D:/usr/webroot/Zendphpweb20/httpd.conf

 代码如下 复制代码
#phpweb20 虚拟主机设置

    ServerName 111com.net
    DocumentRoot D:/usr/webroot/Zendphpweb20/htdocs
  
    
        AllowOverride All
        Options All
    

      
    #修改 PHP 配置(可选)
    php_value include_path .;D:/usr/webroot/Zendphpweb20/include;D:/usr/local/php5/PEAR
    php_value magic_quotes_gpc off
    php_value register_globals off

各个虚拟主机的配置就看应用站点的不同需要了,DocumentRoot 为其根目录(php_value 是修改此站点的 PHP 运行参数,根据自己应用的需要来写,这样就不必修改 PHP 主配置文件)。

4> 重启 Apache 服务:


在httpd-vhosts.conf中配置,在httpd-vhosts.conf配置之前我们需要在apache的httpd.conf找到

 代码如下 复制代码

# Virtual hosts
#Include conf/extra/httpd-vhosts.conf

把前面的#号去了,然后进入extra/httpd-vhosts.conf

写法与在httpd.conf 一样了。

热门栏目