• 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:

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

    我要青春像陈孝正一样,不能有一毫米的误差! 我要青春像合伙人一样,为了自尊而战!
  • 相关阅读:
    centos7查看yum安装的软件及路径
    CentOS7图形界面与命令行界面切换(转载)
    vmware安装centos7
    如何在IE11中设置兼容模式?设置的具体方法
    docker批量删除容器、镜像
    在Linux Centos 7.2 上安装指定版本Docker 17.03
    如何避免命令 rm -rf 的悲剧
    python django整理(五)配置favicon.ico,解决警告Not Found: /favicon.ico(转载)
    Ubuntu终端命令行缩短显示路径
    virtualenv 虚拟环境依赖安装
  • 原文地址:https://www.cnblogs.com/fanglove/p/3089835.html
Copyright © 2020-2023  润新知