03 WAMPServer多站点的配置

来源:互联网 发布:日本海关数据 编辑:程序博客网 时间:2024/05/21 17:13
一、找到wamp根目录
例如:D:\wamp\bin\apache\apache2.4.9\conf\extra下的httpd-vhosts.conf文件
多站点的配置如下:
<VirtualHost *:80>
    ServerAdmin webmaster@dummy-host.example.com
    DocumentRoot "c:/Apache24/docs/dummy-host.example.com"
    ServerName dummy-host.example.com
    ServerAlias www.dummy-host.example.com
    ErrorLog "logs/dummy-host.example.com-error.log"
    CustomLog "logs/dummy-host.example.com-access.log" common
</VirtualHost>


<VirtualHost *:80>
    ServerAdmin webmaster@dummy-host2.example.com  # 设置管理员的邮箱地址
    DocumentRoot "c:/Apache24/docs/dummy-host2.example.com" # 服务器代码的文件目录
    ServerName dummy-host2.example.com  #服务器主机名
    ErrorLog "logs/dummy-host2.example.com-error.log"  # 错误日志
    CustomLog "logs/dummy-host2.example.com-access.log" common  # 日常日志
</VirtualHost>
复制上面的配置文件更改相应的配置文件即可,具体更改如下:
我添加的网站配置信息如下:
<VirtualHost *:80>
    DocumentRoot "D:/PHP_Project/YeHu"
    ServerName YeHu.com
</VirtualHost>


<VirtualHost *:80>
    DocumentRoot "D:/PHP_Project/ButterflyCabin"
    ServerName ButterflyCabin.com
</VirtualHost>


我们配置完httpd-vhost.conf并不会被Apache所加载,因为httpd-vhost.conf是一个扩展配置文件。
二、是Apache加载配置好的扩展配置文件httpd-vhost.conf
打开Apache下的httpd.conf配置文件搜索httpd-vhost
#Include conf/extra/httpd-vhosts.conf 前的#号去掉 在本配置文件中#代表注释本行
!三、让Apache允许外部网站访问 对于新版本的这部可以跳过
<Directory "D:/PHP_Project/">
    #
    # Possible values for the Options directive are "None", "All",
    # or any combination of:
    #   Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
    #
    # Note that "MultiViews" must be named *explicitly* --- "Options All"
    # doesn't give it to you.
    #
    # The Options directive is both complicated and important.  Please see
    # http://httpd.apache.org/docs/2.4/mod/core.html#options
    # for more information.
    #
    Options Indexes FollowSymLinks


    #
    # AllowOverride controls what directives may be placed in .htaccess files.
    # It can be "All", "None", or any combination of the keywords:
    #   AllowOverride FileInfo AuthConfig Limit
    #
    AllowOverride all


    #
    # Controls who can get stuff from this server.
    #


#   onlineoffline tag - don't remove
#Order Deny,Allow
#Allow from all 
    Require local
</Directory>
三、配置hosts 
系统盘——》windows——》System32——》drivers——》etc下的hosts文件
添加如下配置信息:
127.0.0.1       yehu.com
127.0.0.1       butterflycabin.com







0 0
原创粉丝点击