winxp apache用php建本地虛擬主機(jī)的方法
更新時(shí)間:2009年07月15日 00:08:49 作者:
windows xp用php建本地虛擬主機(jī)的方法(注:以下目錄是筆者系統(tǒng)目錄)
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(假設(shè)的DNS)
2 在E:\WAMP\Apache2.2\conf\extra\httpd-vhosts.conf
修改內(nèi)容:
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 (應(yīng)用目錄)
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 檢查是否關(guān)聯(lián)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應(yīng)用目錄)
7 查找 DocumentRoot "E:/WAMP/Apache2.2/htdocs"
改為 DocumentRoot "E:/WAMP/www"
8 查找 ServerRoot "E:/XXX/Apache2.2" (apache安裝目錄)
改為 ServerRoot "E:/WAMP/Apache2.2" (apache服務(wù)器目錄)
9 x.test.com x.test1.com x.test2.com
分別輸入以上三個(gè)進(jìn)行測試
添加如下代碼:
127.0.0.1 localhost
127.0.0.1 x.test.com x.test1.com x.test2.com
注:x.test.com(假設(shè)的DNS)
2 在E:\WAMP\Apache2.2\conf\extra\httpd-vhosts.conf
修改內(nèi)容:
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 (應(yīng)用目錄)
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 檢查是否關(guān)聯(lián)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應(yīng)用目錄)
7 查找 DocumentRoot "E:/WAMP/Apache2.2/htdocs"
改為 DocumentRoot "E:/WAMP/www"
8 查找 ServerRoot "E:/XXX/Apache2.2" (apache安裝目錄)
改為 ServerRoot "E:/WAMP/Apache2.2" (apache服務(wù)器目錄)
9 x.test.com x.test1.com x.test2.com
分別輸入以上三個(gè)進(jìn)行測試
相關(guān)文章
在Linux 服務(wù)器下修改防火墻允許該端口遠(yuǎn)程訪問的方法
今天小編就為大家分享一篇在Linux 服務(wù)器下修改防火墻允許該端口遠(yuǎn)程訪問的方法,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。一起跟隨小編過來看看吧2019-07-07
詳解CentOS 6.4下PXE+Kickstart無人值守安裝操作系統(tǒng)
這篇文章主要介紹了詳解CentOS 6.4下PXE+Kickstart無人值守安裝操作系統(tǒng) ,PXE(Pre-boot Execution Environment,預(yù)啟動(dòng)執(zhí)行環(huán)境)是由Intel公司開發(fā)的最新技術(shù),有興趣的可以了解一下。2016-12-12
如何解決win10與Ubuntu16.04時(shí)間不同步的問題的方法
本篇文章主要介紹了如何解決win10與Ubuntu16.04時(shí)間不同步的問題的方法,非常具有實(shí)用價(jià)值,需要的朋友可以參考下2017-05-05
linux環(huán)境下如何解決“沒有那個(gè)文件或目錄”
這篇文章主要介紹了linux環(huán)境下如何解決“沒有那個(gè)文件或目錄”問題,具有很好的參考價(jià)值,希望對(duì)大家有所幫助,如有錯(cuò)誤或未考慮完全的地方,望不吝賜教2023-11-11
如何創(chuàng)建Linux的swap交換分區(qū)文件的方法步驟
這篇文章主要介紹了如何創(chuàng)建Linux的swap交換分區(qū)文件的方法步驟,小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,也給大家做個(gè)參考。一起跟隨小編過來看看吧2019-03-03
Linux下SFTP用戶權(quán)限設(shè)置條件及實(shí)現(xiàn)命令
SFTP賬號(hào)是基于SSH賬號(hào)的,其擁有的權(quán)限是比較大的,今天主要教大家如何進(jìn)行SFTP用戶權(quán)限設(shè)置,感興趣的你可不要錯(cuò)過了哈,希望本文知識(shí)可以幫助到你2013-02-02
CentOS6 配置Nginx,MySql,php-fpm開機(jī)啟動(dòng)的方法
這篇文章主要介紹了CentOS6 配置Nginx,MySql,php-fpm開機(jī)啟動(dòng)的方法的相關(guān)資料,非常不錯(cuò),具有參考借鑒價(jià)值,需要的朋友可以參考下2016-10-10

