winxp apache用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 web@xxx.com
documentroot e:/wamp/www
servername localhost
errorlog logs/localhost-error_log
customlog logs/localhost-access_log common
</virtualhost>
<virtualhost *>
serveradmin web@xxx.com
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 web@xxx.com
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 web@xxx.com
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
</ifmodule>
改为
<ifmodule dir_module>
directoryindex .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
分别输入以上三个进行测试
如对本文有疑问,
点击进行留言回复!!
相关文章:
-
-
-
-
-
-
-
-
Linux cut 命令详解
cut 命令在linux和unix中的作用是从文件中的每一行中截取出一些部分,并输出到标准输出中。我们可以使用 cut 命令从一行字符串中于以字节,字符,字段(...
[阅读全文]
-
-
-
为Nginx动态添加模块的方法
写在前面很多时候,我们根据当时的项目情况和业务需求安装完nginx后,后续随着业务的发展,往往会给安装好的nginx添加其他的功能模块。在为nginx添加功能模...
[阅读全文]
网友评论