zoukankan      html  css  js  c++  java
  • WAMPServer多站点配置

    1.打开目录C:wampinapacheapache2.4.9confextra,找到httpd-vhosts.conf文件,打开,复制如下内容:

      

    <VirtualHost *:80>
        DocumentRoot "c:/demo/test01"
        ServerName test01.com
    </VirtualHost>

    <VirtualHost *:80>
        DocumentRoot "c:/demo/test02"
        ServerName test02.com
     
    </VirtualHost>

    2.打开Apache下的httpd.conf文件,查找Virtual hosts,将#Include conf/extra/httpd-vhosts.conf前面的#号去除。

    3.打开Apache下的httpd.conf文件,查找demo(网站所放的目录)Directory "c:/demo">,找到如下这段进行修改,修改后结果

      #   onlineoffline tag - don't remove
        Order Deny,Allow  Allow from all  #Allow from 127.0.0.1

    网站资源:

    1、添加站点
    在wamp/bin/apache/Apache2.5/conf/extra中找到并打开httpd-vhosts.conf文件,根据文件中提供的模板新建两个站点,其中servername为站点名,documentroot为站点文件目录,severadmin--设置管理员的邮箱地址,错误日志,日常日志。只用到documentname和servername,其他可删掉。documentroot改成网站所在的目录(必须在apache的根目录下)如网站: “e:/Demo/test01”, servername修改为网站域名。

    2、引入httpd-hosts文件
    因为上面的conf文件是扩展文件,默认下不会加载,需要修apache的配置文件,以包含扩展文件.
    打开Apache->httpd.conf文件,找到virtual hosts
    #Include conf/extra/httpd-vhosts.conf 将Include前的'#'去掉。

    3、允许站点访问服务器资源
    打开Apache->httpd.conf文件,找到onlineoffline tag,修改其后面的Deny from all为Allow from all,同时将Allow from 127.0.0.1修改为注释(前面加‘#’),在2.5版本中,无需进行此操作,默认为Require all granted。
    2.4 的onlineoffline tag:
    Require all denied (对应2.2的Deny from all)
    Require all granted (对应2.2的Allow from all)

    4、为站点添加资源(略)

    5、设置本机访问这些站点时从本机获取资源
    打开c:/windows/system32/drivers/etc/hosts
    在最后添加127.0.0.1 站点的域名(不要忘了.com)如:
    127.0.0.1 test01.com

    127.0.0.1意为本地服务器IP,当浏览器地址栏输入test01.com时,浏览器从本地服务器寻找资源

  • 相关阅读:
    HDU 1069 Monkey and Banana
    HDU 1029 Ignatius and the Princess IV
    HDU 1024 Max Sum Plus Plus
    Gym100923H Por Costel and the Match
    Codeforces 682C Alyona and the Tree
    Codeforces 449B Jzzhu and Cities
    Codeforces (ccpc-wannafly camp day2) L. Por Costel and the Semipalindromes
    Codeforces 598D (ccpc-wannafly camp day1) Igor In the Museum
    Codeforces 1167c(ccpc wannafly camp day1) News Distribution 并查集模板
    快乐数问题
  • 原文地址:https://www.cnblogs.com/shenhainixin/p/5345180.html
Copyright © 2011-2022 走看看