当前位置: 首页 > 图文教程 > 服务器 > Linux服务器 > winxp apache用php建本地虚拟主机的方法

Linux服务器
FreeBSD操作系统安装过程
Ubuntu8.04安装配置PHP+MYSQL环境
接触linux的用户需要掌握的linux命令
配置你的Ubuntu8.04
sudo安装、配置和使用
Linux设置技巧:如何防止入行单用户
服务器设置错误页面转向的特定网页
恢复Linux口令的五种方法
Linux知识:配置Linux网络地址
apache下实现301永久性重定向的方法
linux开机自启动挂载windows的具体步骤
Linux服务器:关闭的Linux机器继续运行ipchains
使用国外Linux主机做网站应该注意的2点
目前热门的以服务器为导向的开源技术
大公司使用Linux系统的使用方式

Linux服务器 中的 winxp apache用php建本地虚拟主机的方法


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-10-04   浏览: 100 ::
收藏到网摘: n/a

windows xp用php建本地虚拟主机的方法(注:以下目录是笔者系统目录) 1 在C:\WINDOWS\system32\drivers\etc\hosts
添加如下代码:
127.0.0.1 localhost
127.0.0.1 x.test.com x.test1.com x.test2.com
注:x.test.com(假设的DNS)
2 在E:\WAMP\Apache2.2\conf\extra\httpd-vhosts.conf
修改内容:
NameVirtualHost *
<VirtualHost *>
ServerAdmin [email protected]
DocumentRoot E:/WAMP/www
ServerName localhost
ErrorLog logs/localhost-error_log
CustomLog logs/localhost-access_log common
</VirtualHost>
<VirtualHost *>
ServerAdmin [email protected]
DocumentRoot E:/WAMP/www/app (应用目录)
ServerName test.com
ServerAlias x.test.com admin.teeume.com
ErrorLog logs/x.test.com-error_log
CustomLog logs/x.test.com-access_log common
</VirtualHost>
<VirtualHost *>
ServerAdmin [email protected]
DocumentRoot E:/WAMP/www/app/assets
ServerName x.test1.com
ErrorLog logs/img.test1.com-error_log
CustomLog logs/img.test1.com-access_log common
</VirtualHost>
#自己建的目录
<VirtualHost *>
ServerAdmin [email protected]
DocumentRoot E:/WAMP/www/test/assets
ServerName x.test2.com
ErrorLog logs/img.test2.com-error_log
CustomLog logs/img.test2.com-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.html
</IfModule>
改为
<IfModule dir_module>
DirectoryIndex index.html index.html.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.com x.test1.com x.test2.com
分别输入以上三个进行测试