XAMPP本机配置域名访问

打开xampp的安装目录,找到 apache\conf\extra 路径下的 httpd-vhosts.conf 文件

打开注释 NameVirtualHost *:80
这句很重要,我就是忘记打开它,结果无论host里配置的什么网址都指向htdoc的根目录
添加站点配置:

<VirtualHost *:80>
    ServerAdmin yang@21cn.com
    DocumentRoot "C:/xampp/htdocs/"
    ServerName localhost
    ServerAlias localhost
    ErrorLog "logs/localhost-error.log"
    =====注意此处是相对地址,有网上是绝对地址的,配置后appach启动不起来
    CustomLog "logs/localhost-access.log" combined
    <Directory "C:/xampp/htdocs/">
        Options Indexes FollowSymLinks
        AllowOverride all
        Order Allow,Deny
        Allow from all
    </Directory>
</VirtualHost>

修改后,保存 httpd-vhosts.conf 文件,并重启Apache。
然后我们来修改Host文件
文件所在位置 C:\WINDOWS\system32\drivers\etc\hosts
在后面添加:

127.0.0.1     v2011.app.com 
192.168.0.206 yang.com
posted @ 2016-04-25 12:17  随缘-随风  阅读(4081)  评论(0编辑  收藏  举报