標籤:
一.修改httpd.conf
把#include conf/extra/httpd-vhost.conf前面的#去掉,意思是讓httpd.conf檔案包含http-vhost.conf這個設定檔。
尋找httpd.conf中的ServerName,如果ServerName的設定不是網域名稱www.abc.com的話,那麼改為ServerNamewww.abc.com,如果要使用ssl之類的東西,那麼改為SreverNamewww.abc.com:80;就是加了個連接埠。
二.修改httpd-vhosts.conf(Apache\conf\extra目錄下)
在最後添加如下代碼: (註:視實際情況而變)
Eg.
<VirtualHost *:80>
DocumentRoot "D:/Apache/htdocs/kohana/" (註:虛擬機器主機路徑)
ServerName ko3.cn (註:網域名稱)
#DirectoryIndex index.php
<Directory "D:/Apache/htdocs/kohana/">
Options FollowSymLinks
AllowOverride All
Order Deny,Allow
Allow from all
DirectoryIndex index.html index.php index.htm
</Directory>
</VirtualHost>
三.對網域名稱進行強制解析轉向到我們的虛擬目錄
開啟C:\WINDOWS\system32\drivers\etc檔案夾下的hosts檔案,在最後添加上自己的本地地址localhost或者自己的ip
Eg.在C:\WINDOWS\system32\drivers\etc目錄下的hosts中的
127.0.0.1 localhost 後面添加
127.0.0.1 ko3.cn phpmyadmin.cn (兩個網域名稱,中間空格隔開)
(註:新增內容視實際情況而變)
httpd -k install -n "name" 建立服務
httpd.exe -w -n "name" -k start
php host-v