winxp apache用php建本地虛擬主機的方法
更新時間:2009年07月15日 00:08:49 作者:
windows xp用php建本地虛擬主機的方法(注:以下目錄是筆者系統(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
分別輸入以上三個進行測試
添加如下代碼:
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
分別輸入以上三個進行測試
相關(guān)文章
CentOS?6?Linux系統(tǒng)添加永久靜態(tài)路由的方法
在Linux系統(tǒng)中,特別是對于服務(wù)器管理而言,正確配置網(wǎng)絡(luò)路由是確保網(wǎng)絡(luò)通信順暢的重要步驟,本文將介紹如何在CentOS?6系統(tǒng)中添加永久靜態(tài)路由,通過本文的學(xué)習(xí),你將能夠掌握如何在不影響現(xiàn)有網(wǎng)絡(luò)配置的情況下,為你的系統(tǒng)添加一條或多條靜態(tài)路由,需要的朋友可以參考下2025-03-03
Ubuntu18.04 linux系統(tǒng)安裝JDK與Mysql的方法
這篇文章主要介紹了Ubuntu18.04 linux系統(tǒng)安裝JDK與Mysql的方法,需要的朋友可以參考下2020-02-02
SSH端口轉(zhuǎn)發(fā)實現(xiàn)內(nèi)網(wǎng)穿透的實現(xiàn)
這篇文章主要介紹了SSH端口轉(zhuǎn)發(fā)實現(xiàn)內(nèi)網(wǎng)穿透的實現(xiàn),文中通過示例代碼介紹的非常詳細,對大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧2019-08-08
Linux 下安裝 memcached 及 memcacheq的方法
這篇文章主要介紹了Linux 下安裝 memcached 及 memcacheq的方法,需要的朋友可以參考下2017-03-03
Windows操作系統(tǒng)下Linux虛擬機的安裝與配置教程圖解
這篇文章主要介紹了Windows操作系統(tǒng)下Linux虛擬機的安裝與配置,本文圖文并茂給大家介紹的非常詳細,具有一定的參考借鑒價值,需要的朋友可以參考下2019-10-10

