wamp 的安装 设置虚拟目录

在apache的httpd.conf 文件下,修改 documentroot到指定的目录 如下:

  • 默认如下:
DocumentRoot "${INSTALL_DIR}/www"
<Directory "${INSTALL_DIR}/www/">
    #
    # 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 +Multiviews

    #
    # 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
    Require local
</Directory>
  • 修改如下:
DocumentRoot "E:/phpws/web/"
<Directory "E:/phpws/web/">
    #
    # 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 +Multiviews

    #
    # 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
#   Require local
#  设置访问权限
    Order Deny,Allow
    Deny from all
    Allow from all
</Directory>
  • 然后修改 httpd-vhosts.conf 文件如下:
# Virtual Hosts
#

<VirtualHost *:80>
    ServerName localhost
    ServerAlias localhost
    DocumentRoot E:/phpws/web
    <Directory  "E:/phpws/web">
        Options +Indexes +Includes +FollowSymLinks +MultiViews
        AllowOverride All
        Require local
    </Directory>
</VirtualHost>

这时在浏览器中输入localhost就可以看见更改的虚拟目录了,

  • 下面修改首页:在httpd.conf 文件下搜索directoryindex
#
# DirectoryIndex: sets the file that Apache will serve if a directory
# is requested.
#可以自己添加默认查找首页
<IfModule dir_module>
    DirectoryIndex index.php index.php3 index.html index.htm
</IfModule>
  • 修改监听的端口:在httpd.conf 文件下搜索Listen
#Listen 12.34.56.78:80
Listen 0.0.0.0:80
Listen [::0]:80
  • DNS 解析,就是把域名解析成网址
在C:\Windows\System32\drivers\etc 目录下:
#   127.0.0.1       localhost
#   ::1             localhost
127.0.0.1           www.php.com
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值