php虚拟机配置

来源:互联网 发布:淘宝商品分类数据库 编辑:程序博客网 时间:2024/05/21 06:20

1、打开apache安装目录下的conf/httpd.conf

搜索Virtual hosts,可以看到:

#Virtual hosts

#Include conf/extra/httpd-vhosts.conf

意思是启用虚拟主机的设置文件httpd-vhosts.conf,虚拟主机的设置都在这个文件下
设置,改为:

#Virtual hosts

Include conf/extra/httpd-vhosts.conf

2、打开apache安装目录下的conf/extra/httpd-vhosts.conf

搜索<VirtualHost *:80>可看到

<VirtualHost *:80>

    ServerAdmin webmaster@dummy-host.example.com

    DocumentRoot " c:/Apache24/docs/dummy-host.example.com"

    ServerName dummy-host.example.com

    ServerAlias www.dummy-host.example.com

    ErrorLog "logs/dummy-host.example.com-error.log"

    CustomLog "logs/dummy-host.example.com-access.log" common

</VirtualHost>

 

修改为:

<VirtualHost 127.0.0.2:80>

<Directory "D:/wamp/www/test">

Options FollowSymLinks IncludesNOEXEC Indexes

DirectoryIndex index.html index.htm index.php

AllowOverride Options FileInfo

Order Deny,Allow 

Allow from all

</Directory>

    ServerAdmin webmaster@dummy-host.example.com

    DocumentRoot "D:/wamp/www/test"

    ServerName dummy-host.example.com

    ServerAlias www.dummy-host.example.com

    ErrorLog "logs/dummy-host.example.com-error.log"

    CustomLog "logs/dummy-host.example.com-access.log" common

</VirtualHost>

重新启动服务器

在D:/wamp/www/test 下随便新建一个php文件,如test.php

在浏览器中输入127.0.0.2就可以直接访问了。