zoukankan      html  css  js  c++  java
  • 本地机apache配置基于域名的虚拟主机详解

    1.打开apache的httpd.conf文件,找到
    # Virtual hosts
    #Include conf/extra/httpd-vhosts.conf
    这一段把Include conf/extra/httpd-vhosts.conf前面的"#"去掉。

    2.修改位于(win7)c:/windows/system32/drivers/etc/目录下的hosts文件
    增加一段:127.0.0.1    x.acme.com(你用来访问的域名)

    3.我用的是wamp包,所以到c:/wamp/bin/apache/Apache2.2.11/conf/extra目录下
    修改文件httpd-vhosts.conf
    NameVirtualHost默认如下:
    NameVirtualHost *:80

    增加:
    <VirtualHost *:80>
        ServerAdmin x@acme.com   
        DocumentRoot "/var/www/html"
        ServerName x.acme.com   
        ErrorLog "logs/x.acme.com-error.log"
        CustomLog "logs/x.acme.com-access.log" common
    </VirtualHost>

    改好然后重启服务器。
    在浏览器中输入http://x.acme.com就可以到你的目录.

    当然如果你是想在现有的web服务器上增加虚拟主机,那么原来localhost的服务要能用的话,需要在上面的基础上加点东西:
     hosts文件里加上:127.0.0.1  localhost
    并在httpd-vhosts.conf文件里增加:
    <VirtualHost *:80>
        ServerAdmin localhost@xxx.com  
        DocumentRoot "/var/www/"
        ServerName localhost   
        ErrorLog "logs/ localhost-error.log"
        CustomLog "logs/ localhost-access.log" common
    </VirtualHost>

  • 相关阅读:
    路由器漏洞调试的一些技巧
    路由器漏洞挖掘利用的一些基础知识
    windows 利用环境变量%PATH%中目录可写提权

    python super原理,不是指父类
    regexp盲注的一些改进
    阿里规范
    阿里规范
    工具类
    Timer 使用 (一)
  • 原文地址:https://www.cnblogs.com/tblog/p/4746842.html
Copyright © 2011-2022 走看看