winxp apache用php建本地虛擬機器主機的方法

來源:互聯網
上載者:User

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 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應用目錄)
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
分別輸入以上三個進行測試
相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.