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

wampserver2.5版本自定义网站根目录and多站点配置

2016-09-12 16:48 337 查看

自定义网站根目录

wampserver 默认是 c:/wamp/www  我们该成自定义的比如  c:/WampProject

需要修改的三个文件

apache下的httpd.conf  

Wampserver的 配置文件wampmanager.ini和wampmanager.tpl(坐下角的www 目录是由wampserver配置文件得到,跟apache修改的保持一致,当然了这个可以不用修改)

步骤1:httpd.conf  documentroot 以及  directory路径 改成 c:/WampProject,最后保存

步骤2:wampmanager.ini和wampmanager.tpl,分别搜索mean.left 修改caption  FileName,注意tpl文件里面的$符号要删掉,最后修改的模样是"WampProject
目录"和"c:/WampProject" ,最后保存

步骤3:重启所有服务
测试 在c:/WampProject下建立test.php,在浏览器运行http://localhost/test.php,出现输出语句则自定义网站根目录正确,并查看左下角图标根目录是否与修改匹配
参考http://jingyan.baidu.com/article/22fe7ced1ca16b3003617f7c.html

多站点配置

步骤1:修改apache扩展的httpd-vhosts.conf文件,添加站点,
<VirtualHost *:80>

    DocumentRoot "c:/WampProject"

    ServerName localhost  

</VirtualHost>

<VirtualHost *:80>

    DocumentRoot "c:/WampProject/Test01"

    ServerName test01.com  

</VirtualHost>

<VirtualHost *:80>

    DocumentRoot "c:/WampProject/Test02"

    ServerName test02.com  

</VirtualHost>
apache默认不加载这个扩展
步骤2:扩展包含到apache里面,修改httpd.conf,搜索httpd-vhosts.conf,去掉#
步骤3:修改httpd.conf,两个directory标签里面,
<Directory />

    AllowOverride none
Allow from all

    #Require all denied

</Directory>

#

# Note that from this point forward you must specifically allow

# particular features to be enabled - so if something's not working as

# you might expect, make sure that you have specifically enabled it

# below.

#

<Directory "c:/WampProject/">

    #

    # 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
Allow from all

    #Require local

</Directory>

步骤4:修改本机的host文件 添加127.0.0.1 test01.com  127.0.0.1  test02.com

步骤5:重启所有服务,浏览器运行test01.com test02.com
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: