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

教程大全 2026-01-08 06:08:09 浏览

1 在C:\WINDOWS\system32\Drivers\etc\Hosts 添加如下代码:127.0.0.1 localhost127.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 *ServerAdmin web@xxx.comDocumentRoot E:/WAMP/wwwServerName localhostErrorLog logs/localhost-error_logCustomLog logs/localhost-access_log commonServerAdmin web@xxx.comDocumentRoot E:/WAMP/www/app (应用目录)ServerName test.comServerAlias x.test.com admin.teeume.comErrorLog logs/x.test.com-error_logCustomLog logs/x.test.com-access_log commonServerAdmin web@xxx.comDocumentRoot E:/WAMP/www/app/assetsServerName x.test1.comErrorLog logs/img.test1.com-error_logCustomLog logs/img.test1.com-access_log common#自己建的目录ServerAdmin web@xxx.comDocumentRoot E:/WAMP/www/test/assetsServerName x.test2.comErrorLog logs/img.test2.com-error_logCustomLog logs/img.test2.com-access_log common============================ winxp 3 检查是否关联php 在E:\WAMP\Apache2.2\conf 找到httpd.conf在末尾是否有如下在代码:############start for php5LoadModule php5_module E:/WAMP/php5/php5apache2_2.DLLPHPIniDir E:/WAMP/php5AddType application/x-httpd-php .php .phtml .php5AddType application/x-httpd-php-source .phps#####end for php5若无则添加上以代码。 4 查找 # Virtual hosts#Include conf/extra/httpd-vhosts.conf 改为 # Virtual hostsInclude conf/extra/httpd-vhosts.conf 5 查找 DirectoryIndex index.html 改为 DirectoryIndex index.html index.html.var index.php6 查找 改为 (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分别输入以上三个进行测试

本文版权声明本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,请联系本站客服,一经查实,本站将立刻删除。

发表评论

热门推荐