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


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
分别输入以上三个进行测试


上一篇:用云主机怎么搭建网站?云主机建网站完整流程

下一篇:云主机为什么要比虚拟主机贵?


Copyright © 2002-2019 测速网 www.inhv.cn 皖ICP备2023010105号
测速城市 测速地区 测速街道 网速测试城市 网速测试地区 网速测试街道
温馨提示:部分文章图片数据来源与网络,仅供参考!版权归原作者所有,如有侵权请联系删除!

热门搜索 城市网站建设 地区网站制作 街道网页设计 大写数字 热点城市 热点地区 热点街道 热点时间 房贷计算器