日期:2014-05-16  浏览次数:20943 次

win2003+Apache2.2虚拟主机配置(单IP绑定多域名)之-- 网上的教程真坑爹

win2003+Apache2.2+PHP5.4 虚拟主机配置(单IP绑定外域名)之-- 网上的教程害死啊

网上真的有很多COPY党,看了很多配制都是差不多的,但就是无一能通过苦B了我两天啊!在这两的无数次的实践、深思、终于把配正确,现将过程记录下来方便日后有一样困扰的朋友的一点帮助!


第一步:打开 D:\Program Files (x86)\Apache Software Foundation\Apache2.2\conf\httpd.conf   文件

1、查找代码 <Directory />  这个在配置方件里是唯一的 然后把<Directory />.....</Directory>里面的值改成如下代码:


<Directory />

    Options FollowSymLinks
    #AllowOverride None
    #AllowOverride all
    Order deny,allow
    #Deny from all

</Directory>


2、查找 #Include conf/extra/httpd-vhosts.conf 代码这个代码在配置里也是唯一的,前面的#号去掉,如果以已去掉了可以略过此步;

第二步:打开 D:\Program Files (x86)\Apache Software Foundation\Apache2.2\conf\extra\httpd-vhosts.conf 这个文件 里面有有两个官方的例子,你照着修改或增加就行了,如果你只想用一个,你只要把另一个注释掉就可以!我的配置代码如下


httpd-vhosts.conf 文件

#
# Virtual Hosts
#
# If you want to maintain multiple domains/hostnames on your
# machine you can setup VirtualHost containers for them. Most configurations
# use only name-based virtual hosts so the server doesn't need to worry about
# IP addresses. This is indicated by the asterisks in the directives below.
#
# Please see the documentation at 
# <URL:http://httpd.apache.org/docs/2.2/vhosts/>
# for further details before you try to setup virtual hosts.
#
# You may use the command line option '-S' to verify your virtual host
# configuration.


#
# Use name-based virtual hosting.
#
NameVirtualHost *:80


#
# VirtualHost example:
# Almost any Apache directive may go into a VirtualHost container.
# The first VirtualHost section is used for all requests that do not
# match a ServerName or ServerAlias in any <VirtualHost> block.
#
#<VirtualHost *:80>
    #ServerAdmin webmaster@dummy-host.ssdxc.com.cn
    #DocumentRoot "D:/Program Files (x86)/Apache Software Foundation/Apache2.2/docs/dummy-host.ssdxc.com.cn"
    #ServerName dummy-host.ssdxc.com.cn
    #ServerAlias www.dummy-host.ssdxc.com.cn
    #ErrorLog "logs/dummy-host.ssdxc.com.cn-error.log"
    #CustomLog "logs/dummy-host.ssdxc.com.cn-access.log" common
#</VirtualHost>


<VirtualHost *:80>
    ServerAdmin webmaster@dummy-host2.ssdxc.com.cn
    DocumentRoot "D:/wwwroot/ssdxc"
    ServerName ssdxc.hx110.com
    ErrorLog "logs/ssdxc-error.log"
    CustomLog "logs/ssdxc-access.log" common
</VirtualHost>



日后有时间我后把这个录成视频教程!