zoukankan      html  css  js  c++  java
  • wampserver2.0下配置虚拟主机

    第一种方法

    1.项目位置

    E:\wamp\www\dazhumsg

    2.找到E:\wamp\bin\apache\Apache2.2.11\conf\extra\httpd-vhosts.conf在文件最后写以下配置

    <VirtualHost *:80>
        #ServerAdmin webmaster@dummy-host2.localhost
        DocumentRoot "E:\wamp\www\dazhumsg"
        ServerName dazhumsg.cn
        DirectoryIndex index.php
        <Directory "e:/wamp/www/">
            Options FollowSymLinks
            AllowOverride all
            Order allow,deny
            Allow from all
            </Directory>
        ErrorLog "logs/dummy-host2.localhost-error.log"
        CustomLog "logs/dummy-host2.localhost-access.log" common
    </VirtualHost>

    3.重启apace服务。可悲的是在浏览器上打dazhumsg.cn不成功

    4.找见httpd.conf打开

    # Virtual hosts
    Include conf/extra/httpd-vhosts.conf

    把Include conf/extra/httpd-vhosts.conf前面的#注释去掉

    5.重启apace服务,更可悲的是在浏览器上打dazhumsg.cn还没成功。擦

    6.直接把2中的代码写到了httpd.conf最底部

    7.dazhumsg.cn成功。

    第二种方法更好一点

    1.重复第一种方法的第四步。

    2.在httpd-vhosts.conf 添加

    <VirtualHost *:80>
        ServerAdmin dazhu@jiade.com
        DocumentRoot "E:/wamp/www/wc"
        ServerName wanjc.com
    </VirtualHost>
    
    #Added this configuration for the WAMP www folder
    <VirtualHost *:80>
        ServerAdmin dazhu@jiade.com
        DocumentRoot "e:\wamp\www"
        ServerName localhost
    </VirtualHost>

    3.重启服务。可以访问了

    4.参考 :http://abou-kone.com/2011/04/25/wamp-apache-error-you-dont-have-permission-to-access-on-this-server/

    error from Apache. A clue about going on to fix this came from commenting out the VirtualHost configuration line again in httpd.conf. That done, I was back in business with my www folder being visible again as well as all the projects within. It seemed that the VirtualHosts configurations were overriding the default Server configuration in httpd.conf. I then added the following code in httpd-vhosts.conf and both my C:\Dev\Workspace and C:\wamp\www folder were again “visible” and I was able to access projects in both locations:

    最后 说一句,可能两种方法的项目名不一样。是因为写这篇随笔,是隔了两天左右了。是再次遇到这个问题后,采用第一种方法不好。才继续去寻找更好的方法。看不懂的见谅

    我要青春像陈孝正一样,不能有一毫米的误差! 我要青春像合伙人一样,为了自尊而战!
  • 相关阅读:
    nginx proxy_cache 缓存配置[转]
    MongoDB使用小结:一些常用操作分享
    PHP读取Mongodb数据报错,Cannot natively represent the long 8331412483000 on this platform
    MongoDB 学习笔记(python操作)
    Python 中 os.path模板
    Python 优雅的操作字典【转】
    MongoDB 一对多关系建模
    nginx之location配置
    MongoDB安装Windows服务
    .net4.0 请求HTTPS出错:未能创建 SSL/TLS 安全通道
  • 原文地址:https://www.cnblogs.com/fanglove/p/3089835.html
Copyright © 2011-2022 走看看