winxp apache用php建本地虚拟主机的方法

admin3年前主机评测77

1 在C:\WINDOWS\system32\drivers\etc\hosts
添加如下代码:
127.0.0.1 localhost
127.0.0.1 x.test x.test1 x.test2
注:x.test(假设的DNS)
2 在E:\WAMP\Apache2.2\conf\extra\httpd-vhosts.conf
修改内容:
NameVirtualHost *
<VirtualHost *>
ServerAdmin web@xxx
DocumentRoot E:/WAMP/www
ServerName localhost
ErrorLog logs/localhost-error_log
CustomLog logs/localhost-access_log common
</VirtualHost>
<VirtualHost *>
ServerAdmin web@xxx
DocumentRoot E:/WAMP/www/app (应用目录)
ServerName test
ServerAlias x.test admin.teeume
ErrorLog logs/x.test-error_log
CustomLog logs/x.test-access_log common
</VirtualHost>
<VirtualHost *>
ServerAdmin web@xxx
DocumentRoot E:/WAMP/www/app/assets
ServerName x.test1
ErrorLog logs/img.test1-error_log
CustomLog logs/img.test1-access_log common
</VirtualHost>
#自己建的目录
<VirtualHost *>
ServerAdmin web@xxx
DocumentRoot E:/WAMP/www/test/assets
ServerName x.test2
ErrorLog logs/img.test2-error_log
CustomLog logs/img.test2-access_log common
</VirtualHost>
============================
3 检查是否关联php
在E:\WAMP\Apache2.2\conf 找到httpd.conf
在末尾是否有如下在代码:
############start for php5
LoadModule php5_module E:/WAMP/php5/php5apache2_2.dll
PHPIniDir E:/WAMP/php5
AddType application/x-httpd-php .php .phtml .php5
AddType application/x-httpd-php-source .phps
#####end for php5
若无则添加上以代码。
4 查找
# Virtual hosts
#Include conf/extra/httpd-vhosts.conf
改为
# Virtual hosts
Include conf/extra/httpd-vhosts.conf
5 查找
<IfModule dir_module>
DirectoryIndex index
</IfModule>
改为
<IfModule dir_module>
DirectoryIndex index index.var index.php
</IfModule>
6 查找 <Directory "E:/WAMP/Apache2.2/htdocs">
改为 <Directory "E:/WAMP/www"> (www为apache应用目录)
7 查找 DocumentRoot "E:/WAMP/Apache2.2/htdocs"
改为 DocumentRoot "E:/WAMP/www"
8 查找 ServerRoot "E:/XXX/Apache2.2" (apache安装目录)
改为 ServerRoot "E:/WAMP/Apache2.2" (apache服务器目录)
9 x.test x.test1 x.test2
分别输入以上三个进行测试

免责声明:本文内容来自用户上传并发布,站点仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。请核实广告和内容真实性,谨慎使用。

相关文章

浅析虚拟主机服务器php fsockopen函数被禁用的解决办法_PHP教程

一、如何禁用fsockopen()下面是两种常用的禁用fsockopen的方法。1、修改php.ini,将 disable_functions = 后加入 fsockopen2、修改php.ini,将...

云虚拟机如何配置php网站

云虚拟机配置php网站的方法:1、登录云虚拟机;2、安装PHP软件,使用FTP将PHP软件上传到云虚拟机中;3、打开iis信息服务管理器并开启php扩展;4、找到需要配置PHP环境的网站配置主目录信息...

虚拟主机php版本是什么意思

虚拟主机php版本是值:虚拟主机php版本是指当前虚拟主机所启用的PHP版本信息,不同的php版本,有着不同的优缺点,依据网站系统来选择匹配版本。具体分析如下:虚拟主机版本是根据网站程序来决定,合适、...

Windows2003+IIS7 Express使用FastCgi运行php

想在windows 2003中好好跑php,又要节省内存,真是很为难的事情,考虑到IIS7.5 Express可以在WIN2003上跑,不但能以fastcgi的方式支持php,还自带Rewrite组件...

wamp服务器访问php非常缓慢的解决过程

wamp这两天明显比以前访问要慢很多,重启了下,刚开始还有效,后来重启也没用,就在网上查了下原因,分享给需要的朋友。可能原因1、apache  access.log文件过大 (本人就是用这个...

Mac下搭建php开发环境教程

Mac OS X 内置了Apache 和 PHP,这样使用起来非常方便。本文以Mac OS X 10.6.3为例。主要内容包括:启动Apache运行PHP安装MySQL使用phpMyAdmin配置PH...